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!