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 件のコメント
John D'Errico
John D'Errico 2018 年 2 月 24 日
I reformatted the question to be readable.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by