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 件)
Aditya Srikar
2023 年 5 月 25 日
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.
0 件のコメント
参考
カテゴリ
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!