I already get a point series of the bode plot,(that is, system gain in frequency domain),{{freq1, gain1},{freq2,gain2}....} named as $data$
So I first assume that the transfer function is in the form of $$model=\frac{a1s^2+b1s+c1}{a2s^2+b2s+c2}$$ (by analyzing the bode plot, the tf should be in this form)
and then I use $FindFit$ function to estimate parameters $vars=\{a1,b1,c1,a2, b2,c2\}$
$$FindFit[data,Abs@model,vars,s]$$ however what I get is totally wrong, the fitting result gives a very high peak around 0 and never match the shape of original bode plot.
so, can you guys give some advice on how to estimate transfer function with mathematica
I know matlab has tfest. however, in my case, for some reason, it is better to do that is mathematica
\
Here is an example showing my process, with some simulation data, not the real experimental one.
fitmodel=Abs[n1/(a*(s*I)^4 + b*(s*I)^3 + c*(s*I)^2 + d*(s*I) + e)];
par={n1, a, b, c, d, e};
givenpar = Thread[par -> {500000, 1, 30, 26300, 270000, 25000000}];
givengain = Table[fitmodel /. givenpar, {s, 1, 300, 1}];
fitpar = FindFit[givengain, fitmodel, par, s];
fitgain = Table[fitmodel /. fitpar, {s, 1, 300, 1}];
{{n1, 480000}, {a, 1}, {b, 25}, {c, 25000}, {d, 250000}, {e, 26000000}}
$\endgroup$