필터 지우기
필터 지우기

How can I fit data to a sine curve?

조회 수: 163 (최근 30일)
Careniena Opem
Careniena Opem 2019년 9월 28일
답변: Star Strider 2019년 9월 28일
Given a set of data points, how can I find the curve of best fit if I know that this will be a sine curve and nothing else?

답변 (2개)

John D'Errico
John D'Errico 2019년 9월 28일
I'll guess the model you want is as below, but use the curve fitting toolbox.
Your model might be defined as:
ft = fittype('sin((x - shift)/xscale)*yscale','coefficients',{'shift','xscale','yscale'})
ft =
General model:
ft(shift,xscale,yscale,x) = sin((x - shift)/xscale)*yscale
Now just call fit to fit the model to your data.
mdl = fit(X,Y,ft,'startpoint',[shiftguess,xscaleguess,yscaleguess]);
Other toolboxes have similar capability, but not quite as easy to use as the CFTB. (Stats TB, optimization TB)
  댓글 수: 1
Careniena Opem
Careniena Opem 2019년 9월 28일
I do not have the curve fitting toolbox, but I do have stats and optimization.

댓글을 달려면 로그인하십시오.


Star Strider
Star Strider 2019년 9월 28일
It just uses core MATLAB functions. No toolboxes needed at all.

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by