MATLAB Answers

Fitting an equation to a Sine Function with NonLinearModel.fit

1 ビュー (過去 30 日間)
Wesley Brown
Wesley Brown 2019 年 12 月 4 日
コメント済み: Wesley Brown 2019 年 12 月 7 日
I am trying to fit an equation to a set of data that behaves like the sine wave. The data is graphed below:
I already tried using the "cftool" function in matlab but it did not have the equation I need.
I need to use the following equations:
y = a0 + a1*x + a2*sin(a3*x+a4)
y = a1*x + a2*sin(a3*x+a4)
y = a0 + a1*x + a2*sin(a3*x+a4) + a5*sin(a6*x+a7)
Does anyone know how to use "NonLinearModel.fit" in order to fit one of the above functions to the graphed data? The x and y matrices are listed below.
Thanks in advance!
x = [0
90
180
270
360
450
540
630
720
810
900
990
1080
1170
1260
1350
1440];
y = [0
0.00599999999997181
0.00999999999999091
0.00499999999999545
0.0029999999999859
0.0029999999999859
0.00999999999999091
0.0149999999999864
0.0159999999999627
0.0029999999999859
0.00399999999996226
0.00599999999997181
0.00199999999995271
0.0109999999999673
0.0129999999999768
0.00999999999999091
0.00399999999996226];

  0 件のコメント

サインイン to comment.

採用された回答

Stephan
Stephan 2019 年 12 月 5 日
"...I already tried using the "cftool" function in matlab but it did not have the equation I need...."
Did you notice that you can take adcantage of the custom function in cftool? Have a read here:

  1 件のコメント

Wesley Brown
Wesley Brown 2019 年 12 月 7 日
This is great! I can’t believe I didn’t see this.
Thank you!

サインイン to comment.

その他の回答 (0 件)

サインイン してこの質問に回答します。


Translated by