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

2 Ansichten (letzte 30 Tage)
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?

Akzeptierte Antwort

Roger
Roger am 6 Apr. 2015
save theta_fit(t) fitdata; load fitdata;

Weitere Antworten (0)

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by