1
$\begingroup$

I'm wondering of anyone can explain why invfreqs() is unable to fit a polynomial to the data in the image below. The red line is the measured frequency response of an analog system. I should mention that this data is a logarithmic sweep from 100 Hz to 100 GHz. The blue line is the 11th order invfreqs fit (11th order in both numerator and denominator). 11th order does the best job, but as you can see, there is a massive offset from DC to a few MHz. Everything from 1 GHz and above is a stellar fit.

Any idea why the low freqs don't fit?

enter image description here

UPDATE: Problem solved. The frequency vector must be normalized to keep the computation accurate. I divided it by 1e6. Then the b,a coefficients are converted into zpk form. Multiply z and p by 1e6.

%% estimate transfer function using invfreqs()

H = freq_resp;
samples = length(H);

w_norm = w/1e6;

wts = 0:samples-1;
wts = exp(-wts);

[b,a] = invfreqs(H,w_norm,15,15,wts,50);

[z,p,k] = tf2zp(b,a);

zs = z*1e6 ;
ps = p*1e6 ;

[bs,as] = zp2tf(zs,ps,k);

sys_pred = tf(bs,as);
figure
bode(sys_true,'r',sys_pred,'b')

enter image description here

$\endgroup$
  • $\begingroup$ From what you wrote, it's very hard to tell what's going on. Do you use the iterative mode of invfreqs? You can try to use a weighting function with higher weights at low frequencies, which means that the algorithm focuses more on the approximation at low frequencies. You could also make your measured frequency response data available, so other people can have a look what's going on. $\endgroup$ – Matt L. Jul 11 '15 at 9:47
  • $\begingroup$ Thanks @MattL., I used an exponential decay weighting function and that really did the trick. $\endgroup$ – CMDoolittle Jul 13 '15 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.