On Feb 23, 9:52 pm, "Bill " <william.nospam.a.c...@gm.com> wrote:
> Why use magnitude only?
>
> if you have any reasonable model of the data, use "tf" from
> the Control System toolbox to construct an LTI model using
> the numerator and denominator coefficient set.
I have the mag and phase from the fft, but I dont have a model for the
data, can this be created like this:
[num,den] = invfreqs/invfreqz(mag,freq,nb,na) ... warnings for
invfreqs///invfreqz: (Matrix is close to singular or badly
scaled.Results may be inaccurate.///Warning: W has values outside the
interval [0,pi]. INVFREQZ aliases such values into this interval and
designs a real filter. To design a complex filter, use the 'complex'
flag.)
Also, if I had this model defined by num and den, then:
sys=tf(num,den);
pzplot(sys)
will give the polezero reponse
Is this invfreqz/invfreqs worth a second lookat?
> Use [mag,ph]=bode(sys) to produce the gain and phase from the model and
> pass it as the predicted y(:,2)to lsqcurvefit given your x
> frequencies. You will need to have a set of numerator and
> denominator initial guesses. The thing should converge in
So is this fit is for the model. This is the form I've come up with
for the curvefit
intial~[1 1 1 1] %
fit=lsqcurvefit(@(fit,freq)
myfitfunctions(fit,freq),initial,freq,mag);
function F = myfitfunction(fit,w)
F=(fit(1)*w+fit(2))/((fit(3)*w+fit(4)); %assumed model
> just a few iterations. If the fit is not that great, your
> model is NFG. Pick a better splane model and continue the
> solution.
>
> All you need to prepare is a function which accepts the
> numerator and denominator coefficients in a vector and a
> frequency vector. Compute the predicted gain and phase
> using [mag,ph]=bode(tf(num,den),w), where w is the passed
> frequency band.
>
> That's all it takes. Once you have the transfer function
> coefficients that fit the bode data, use them to compute
> the pole/zero form using pzplot.
Again I wonder that INVFREQS maybe the way to go after all, perhaps
I'm misunderstanding something here.
Thank you for your help, it has given me other ways of thinking about
the problem.
