Curve fitting of PSD?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Parametric Spectral Estimation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!