Beispiel #1
0

# Time Data Stuff

fig = figure(1)

model.plot_resp(data.t,data.input,fig=fig,clear=True,title='Model vs. Exp',linelabel='Initial Guess')
opt_model.plot_resp(data.t,data.input,fig=fig,clear=False,linelabel='Optimized Model',linestyle=':',linewidth=3)
data.plot_output(fig=fig,clear=False,linelabel='Data Output',linestyle='--',linewidth=3)
data.plot_input(fig=fig,clear=False,linelabel='Data Input',linestyle='-',linewidth=1)

# Frequency Data Stuff

freq_data = data.experimental_transferfunction()
#freq_data.trim_at_freq(10)

freq_opt_dict = fit_freq(model,freq_data)
opt_freq_model = Model(num_dict,den_dict,freq_opt_dict)

fig = figure(2)
model.plot_bode(freq_data.f,fig=fig,linelabel='Guess',linestyle='-')
opt_freq_model.plot_bode(freq_data.f,fig=fig,linelabel='Opt',linestyle='-')
freq_data.plot_bode(fig=fig,linelabel='Swept Freq Bode',linestyle='-')

# Coherence

fig = figure(3)
data.plot_coherence(fig=fig,linestyle='-')

show()
#data.scale_output(1.0/128/4*2*pi)

model = Model(num_dict,den_dict,var_dict,to_opt_dict)

opt_dict = fit_time(model,data)
opt_model = Model(num_dict,den_dict,opt_dict)


# Time Data Stuff

fig = figure(1)

model.plot_resp(data.t,data.input,fig=fig,clear=True,title='Model vs. Exp',linelabel='Initial Guess')
opt_model.plot_resp(data.t,data.input,fig=fig,clear=False,linelabel='Optimized Model')
data.plot_input(fig=fig,clear=False,linelabel='Data Input')
data.plot_output(fig=fig,clear=False,linelabel='Data Output')

# Frequency Data Stuff

freq_data = data.experimental_transferfunction()

#freq_opt_dict = fit_freq(model,freq_data)
#opt_freq_model = Model(num_dict,den_dict,freq_opt_dict)

fig = figure(2)
model.plot_bode(freq_data.f,fig=fig,linelabel='Guess')
#opt_freq_model.plot_bode(freq_data.f,fig=fig,linelabel='Opt')
freq_data.plot_bode(fig=fig,linelabel='Swept Freq Bode')

show()
Beispiel #3
0
# data.scale_output(1.0/128/4*2*pi)

model = Model(num_dict, den_dict, var_dict, to_opt_dict)

opt_dict = fit_time(model, data)
opt_model = Model(num_dict, den_dict, opt_dict)


# Time Data Stuff

fig = figure(1)

model.plot_resp(data.t, data.input, fig=fig, clear=True, title="Model vs. Exp", linelabel="Initial Guess")
opt_model.plot_resp(data.t, data.input, fig=fig, clear=False, linelabel="Optimized Model")
data.plot_input(fig=fig, clear=False, linelabel="Data Input")
data.plot_output(fig=fig, clear=False, linelabel="Data Output")

# Frequency Data Stuff

freq_data = data.experimental_transferfunction(fixed_sine_freq)

freq_opt_dict = fit_freq(model, freq_data)
opt_freq_model = Model(num_dict, den_dict, freq_opt_dict)

fig = figure(2)
model.plot_bode(fixed_sine_freq, fig=fig, linelabel="Guess")
opt_freq_model.plot_bode(fixed_sine_freq, fig=fig, linelabel="Opt")
freq_data.plot_bode(fig=fig, linelabel="Fixed Freq Bode")

show()