How to export a fourier series in its function form after using the curve-fitting method?

8 次查看(过去 30 天)
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?

采纳的回答

Roger
Roger 2015-4-6
save theta_fit(t) fitdata; load fitdata;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by