フィルターのクリア

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 Center および File ExchangeGet 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