Can I improve my result using Linear Model.stepwise but how can I use 'polyijk' with my example?

조회 수: 2 (최근 30일)
x1=[];
y1=[];
for k=1:4:412
x1=A(:,k+2);
y1=A(:,k);
xx=find(y1);
xxx=max(xx);
y2=smooth(x1(1:xxx),y1(1:xxx),'moving',3);
[p S mu]= polyfit(x1(1:xxx),y2,3);
f=polyval(p,x1(1:xxx));
for l=1:xxx
A(l,k)=A(l,k)-f(l);
end
Can I use Linear Model.stepwise but want to know how can I use with this?
Type of error coming how can I make good results warning(message('MATLAB:polyfit:RepeatedPoints'));
In polyfit at 74 Warning: Polynomial is badly conditioned. Add points with distinct X values or reduce the degree of the polynomial.
I am using this
[p S mu]= polyfit(x1(1:xxx),y2,3);

답변 (1개)

dpb
dpb 2013년 8월 28일
warning(message('MATLAB:polyfit:RepeatedPoints'));
In polyfit at 74 Warning: Polynomial is badly conditioned. Add points with distinct X values or reduce the degree of the polynomial.
how can I make good results
Follow the directions. You've got too many repeated (or nearly so) independent variable values. Since the polynomial degree chosen was 3, try quadratic instead (polynomials of higher degree are seldom a good choice, anyway, altho there are always exception).
But since a cubic isn't terribly high power, one presumes you don't have many points to begin with and they're not well placed across the range of x.

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by