Curve fitting of PSD?

5 次查看(过去 30 天)
gaurav Nanda
gaurav Nanda 2012-4-23
Hello, I need help for the curve fitting. I am using the following command but there is some problem with it.
NFFT=2^nextpow2(L);
Y1=fft(y-mean(y))/L; % Y1 is FFT
fc=Fs/2*linspace(0,1,NFFT/2+1);
Y2=2*abs(Y1(1:NFFT/2+1));%absolute value of FFT
Nc=(Y2).^2; % Nc is PSD
plot(fc,Nc);
g1=fittype('a1-x*p1', 'coef',{'a1','p1'});
options=fitoptions('Method','nonlinearleastsquares','lower',[-25 0], 'upper',[-5 4]);
options.startpoint=[-12,1];
options.TolFun=1e-12;
loglog(fc(1:length(fc)), Nc(1:NFFT/2+1),'b');
curvec= FIT(log10(fc(1:length(fc))),log10(Nc(1:NFFT/2+1)),g1);
=------------------------------- could you please tell me what is wrong with the command?
Thanks

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parametric Spectral Estimation 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by