in curve fitting of linear sinusoidal function with polynomial of 4th degree, the error popping up is define b and x_l

1 次查看(过去 30 天)
I am new to matlab. I would appreciate to sort this out of curve fitting algorithm of linear sinusoidal function with polynomial of 4th degree
m=input('enter order:');
n=input('enter number of data points:');
x=[1 2 3 4 5 6];
y=b(0)+b(1)*sin(x)+b(2)*sin(x).^2;
x_l_mat=[];
y_l_mat=[];
x_l_mat=[x_1_mat; x_1];
y_1_mat=[y_1_mat; y_l];
if (n<(m+1))
disp('regression is impossible');
else
for i=1:m+1
for j=1:i
k=i+j-2;
sum=0;
for l=1:n
sum=sum+(x_l).^k;
end
a_(i,j)=sum;
a_(j,i)=sum;
end
sum=0;
for l=1:n
sum=sum+y_l.x_l^(i-1);
end
a_(i,m+2)=sum;
end
end
  3 个评论

请先登录,再进行评论。

回答(0 个)

类别

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