I have some questions while fitting curves using Fourier function. The maximum order defined in Matlab itself is 'Fourier8', can I use 9 or 10 order Fourier functions for fitting?
I can construct a anonymous function in my codes, but the problem is it can NOT give a good fitting result. This is same if I define a Fourier8 function by myself.
My understanding is while using 'Fourier8', those coefficients a0,...a8,b1...,b8 are fitting using linear term while w is the nonlinear term.
On the other hand, the use of an anonymous function definition results all coeff are nonlinear term.
My codes here:
ft_ = fittype('fourier8'); % system defined
myFt = myfittype (@(a0,a1,b1,a2,b2,a3,b3,a4,b4,a5,b5,a6,b6,a7,b7,a8,b8,w,x) a0 + a1*cos(x*w) + b1*sin(x*w) + ... + a10*cos(10*x*w) + b10*sin(10*x*w)); of course there are a2,...a9 and b2,...b8 in the middle but not type here.