evaluate curve fit sum of sine
Mostrar comentarios más antiguos
Good evening,
I am having troubles in evaluating my curve fitting using the sum of sines methot, as it best suits my datas.
I have read the related page that prompts by typing doc cfit, but it seems to be relatend only with polynomial curve fitting.
Basically I need to have something to input in another function, to evaluate P(t).
I'have tried to copy the general model with the given coefficients and replace x with a t vector from 0 to 1.4 in order to do so, but it seems not to work.
What am I doing wrong?
Is there a quicker/easier way to do so?
Thanks for your help!

Respuestas (1)
The cfit object returned by fit() can be used as a function handle, to evaluate the fitted function at any desired query points.
load enso;
f = fit( month, pressure, 'sin6');
y=f(50), %evaluate at t=50
So, you can just pass f around to any code that needs to query the fit.
2 comentarios
Giulio Rossi
el 28 de Mzo. de 2021
You cannot perform multiplications with a fit object, but you can multiply with values returned by a fit object, e.g.,
load enso;
f = fit( month, pressure, 'sin6');
y=f(1:10).',
ytimes10 = 10*f(1:10).'
Categorías
Más información sobre Get Started with Curve Fitting Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!