I am trying to do a curve fitting for a waveform obtained from the division of 2 FFT data. So, I used invfreqz in Matlab so that I can obtain the transfer function of the waveform, and at the same time, find an estimated waveform for the curve obtained. However, I cant seem to do it using this method, even though I had used the varience as the wt of the invfreqz. May I know does anyone knows what went wrong? Really appreaciate any help given. Thanks.

wt(1:k)=0.0002;

wt(1:405)=1;

ff = f1(1:(k));

f_norm = ff / f1(k)*pi;

[num,den]=invfreqz(tf1(1:k), f_norm,3,4,wt)

[h2,w2] = freqz(num,den,k);