Clear Filters
Clear Filters

Matlab curve fitting toolbox acting weird

2 views (last 30 days)
I am entering v as x variable and G as y variable in matlab toolbox and fitting it using sum of sines, no. of terms =2
v=-90:90;
B=65;
G=(v./B).^2;
I am getting output shown below. This shows a great fit. But when I write the equation using coefficients given by matlab myself, the graph I get is not the same!!!
fitresult(x) = a1*sin(b1*x+c1) + a2*sin(b2*x+c2)
Coefficients (with 95% confidence bounds):
a1 = 504.9 (-6.058e+08, 6.058e+08)
b1 = 0.01277 (-26.03, 26.06)
c1 = 1.571 (1.525, 1.617)
a2 = 505 (-6.058e+08, 6.058e+08)
b2 = 0.01281 (-25.95, 25.98)
c2 = -1.571 (-1.617, -1.525)
  4 Comments
Haneya Qureshi
Haneya Qureshi on 4 Oct 2019
Problem got resolved! Thank you so much! It was the number of decimal places!!! I was taking rounded off values by copy pasting directly from the curve fitting toolbox. Thanks a lot!
Haneya Qureshi
Haneya Qureshi on 4 Oct 2019
Very valuable insights given by you! Much appreciated!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!