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);
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!