fitsys 243
# Create fitting weight. 1/s works well for logspaced
# data.
wght = 1/makepoly([1,0],"s")
# Fit new system and compare pole location with
# the original. Note that it is minimum phase.
nsys = fitsys(cdata,3,3,wght)
rifd(nsys)
Poles:
real imaginary frequency damping
(rad/sec) ratio
-5.1043e-02 -3.1249e-01 3.1663e-01 0.1612
-5.1043e-02 3.1249e-01 3.1663e-01 0.1612
-5.0107e+00 0.0000e+00 5.0107e+00 1.0000
Zeros:
real imaginary frequency damping
(rad/sec) ratio
-1.0189e+00 0.0000e+00 1.0189e+00 1.0000
-5.0906e-01 -3.0989e+00 3.1405e+00 0.1621
-5.0906e-01 3.0989e+00 3.1405e+00 0.1621
nsysg = freq(nsys,omega)
gph2 = ctrlplot([plantg,nsysg],{bode});
gph2 = plot(gph2,{title="Data and minimum phase fit",...
legend=["original system";"minimum phase system"]})?