Curve fitting - periodic function

조회 수: 9 (최근 30일)
Alexandre
Alexandre 2012년 2월 6일
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