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 Center および File Exchange で Linear and Nonlinear Regression についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!