How to export a fourier series in its function form after using the curve-fitting method?
Show older comments
I have constructed the following fitting for some periodic data y(:,1), so
theta_fit = fit(t,y(:,1),'fourier8'),
theta_fit =
General model Fourier8:
theta_fit(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) +
a4*cos(4*x*w) + b4*sin(4*x*w) + a5*cos(5*x*w) + b5*sin(5*x*w) +
a6*cos(6*x*w) + b6*sin(6*x*w) + a7*cos(7*x*w) + b7*sin(7*x*w) +
a8*cos(8*x*w) + b8*sin(8*x*w)
I know I can plot them using
plot(t,theta_fit(t),'r')
But then how do I extract theta_fit(x) as a symbolic functio, such that I can use theta_fit(t) in some other programs?
Accepted Answer
More Answers (0)
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!