After fitting the data using `fourier3` function in MATLAB, you can use the `coeffvalues` function to extract the Fourier series coefficients, then calculate the amplitude using the first 3 terms of the Fourier series. For calculating the wavelength and wavenumber, use the third term of the Fourier series with the formulas `wavelength = 2*pi/k` and `wavenumber = k`, where `k` is the coefficient for the third harmonic.
Fourier series curve fitting amplitude
10 次查看(过去 30 天)
显示 更早的评论
Hello all,
A quick question regarding fourier curve fitting.
I am using the following:
f=fit(x, y, 'fourier1');
formula(f);
x{i} = x;
y{i} = y;
predicted_y{i} = f(x);
coefficients = coeffvalues(f)
Fit_Amplitude(i) = (coefficients(1,2)^2 + coefficients(1,3)^2)^0.5;
Fit_Wavelength(i) = (2*pi)/coefficients(1,4);
Fit_Wavenumber(i) = coefficients(1,4);
Where fourier1 is f(x) = a0 + a1*cos(x*w) + b1*sin(x*w)
I am using fourier1 but I found that it is not accurate enough, I want to switch to fourier3, the equation will be:
f(x) = a0 + a1*cos(x*w) + b1*sin(x*w) + a2*cos(2*x*w) + b2*sin(2*x*w) + a3*cos(3*x*w) + b3*sin(3*x*w)
Any idea on how to find Amplitude and wavelength through fourier3?
Thank you!
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!