Curve fitting - periodic function

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

采纳的回答

Richard Willey
Richard Willey 2012-2-6
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 个评论
Alexandre
Alexandre 2012-2-7
Thank you very much, this was exactly what I was looking for!

请先登录,再进行评论。

更多回答(1 个)

Andrew Newell
Andrew Newell 2012-2-6
You could try selecting "Sum of sin functions" for the type of fit.

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by