Fourier series curve fitting amplitude
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Aditya Srikar
le 25 Mai 2023
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 commentaires
Voir également
Catégories
En savoir plus sur Curve Fitting Toolbox 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!