MATLAB find coefficients for a specific equation?

I was given the equation:
Ft=A0+(A1*t)+(A2*cos(t*w0))+(B1*sin(t*w0));
w0=(2*pi/365);
I am given a vector of 900 points for t,Ft coordinates and need to find the coefficients to give me the best fit for the given equation.
How would I do that?

6 件のコメント

Image Analyst
Image Analyst 2018 年 3 月 6 日
Please attach your t and Ft data in a .mat file. You might try using fitnlm() in the stats toolbox.
John D'Errico
John D'Errico 2018 年 3 月 6 日
What do you have?
Stats toolbox? REGRESS will be sufficient, since w0 is known.
Curve fitting toolbox? FIT will suffice.
No toolbox? Backslash, or lsqr, Lots of options.
So depending on what you have there are lots of solutions. But before we can offer the best advise, we need to know what you have.
Michelle Babak
Michelle Babak 2018 年 3 月 6 日
編集済み: Walter Roberson 2018 年 3 月 7 日
I downloaded curve fitting toolbox and tried to use it:
t=Time1-22232;
w0=(2*pi/365);
X=fittype('A0+(A1*Time)+(A2*cos(Time*w0))+(B1*sin(Time*w0))','coeff',{'A0','A1','B1','B2'});
fit(t,Thick,X)
Time, Thick are the coordinates I am given
It still didnt work.
Walter Roberson
Walter Roberson 2018 年 3 月 7 日
X = fittype(@(A0,A1,A2,B1,Time) A0+(A1*Time)+(A2*cos(Time*w0))+(B1*sin(Time*w0)), 'Independent', 'Time');
Michelle Babak
Michelle Babak 2018 年 3 月 7 日
And then how do you use the fit() function with that?
Walter Roberson
Walter Roberson 2018 年 3 月 7 日
fit_results = fit(t(:), Thick(:), X)
You might want to add a 'Startpoint' option with an initial guess

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

質問済み:

2018 年 3 月 6 日

コメント済み:

2018 年 3 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by