Curve fitting - periodic function

37 visualizaciones (últimos 30 días)
Alexandre
Alexandre el 6 de Feb. de 2012
Hi,
I would like to fit a curve to a set of data (I know the function is periodic). The problem is, all the fittings I tried are unable to reproduced the periodicity of the function.
Is there any way to use the curve fitting toolbox to fit a periodic function data set using only 1 period?
Thank you, Alex

Respuesta aceptada

Richard Willey
Richard Willey el 6 de Feb. de 2012
Here's a pretty basic example
X = linspace(0, 2*pi, 100);
X = X';
Y = sin(X) + randn(100,1);
foo = fit(X,Y, 'sin1')
scatter(X,Y);
hold on
plot(foo)
  1 comentario
Alexandre
Alexandre el 7 de Feb. de 2012
Thank you very much, this was exactly what I was looking for!

Iniciar sesión para comentar.

Más respuestas (1)

Andrew Newell
Andrew Newell el 6 de Feb. de 2012
You could try selecting "Sum of sin functions" for the type of fit.

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by