Fourier Series Fitting using Fit function

13 views (last 30 days)
Mustafa Al-Nasser
Mustafa Al-Nasser on 9 Dec 2021
Answered: Gautam on 20 Feb 2024
Dear All;
There is a command to fit different fucntion to data , this command called "Fit" which is also used to fit data to fourier series but when i check types of functions that command fit data into , i could find " fourier3 ... fourier8" and even when i check "Fit" function code i could not find it , any one can helo why is not shown in code and how can i get it?

Answers (1)

Gautam
Gautam on 20 Feb 2024
Hello, Mustafa
You can use the “fit” function to fit a Fourier model to your data by following the ode format below
f = fit(x, y, 'fourier2');
where the parameters x and y are the data points and the parameter ‘fourier2’ specifies the type of function to be used to fit the data.
The fit function supports the Fourier model type 'fourier1', 'fourier2'… up to 'fourier8' as of release R2021a.
You can find more examples on fitting a Fourier model to data from the “Fit Fourier Models Using the fit Function” section of the document below:
  1. Fourier Series: https://www.mathworks.com/help/releases/R2021a/curvefit/fourier.html?searchHighlight=fourier%20series&s_tid=doc_srchtitle
Thank You,
Gautam

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!