Polyval input when manual value

5 ビュー (過去 30 日間)
Benjamin
Benjamin 2015 年 1 月 5 日
編集済み: dpb 2015 年 1 月 5 日
Hi, I create a first 3*5 matrix using polyfit() corresponding to 3 curves
for xx=1:length(pix_x)
y=BrightTN(:,pixels(xx));
p=polyfit(x,y,4);
P(xx,:)=p(1,:);
y1= polyval(p,x);
plot(x,y1,Color(xx))
end
When using polyval() on these, everything fine, i get value between 0 and 1.
R=zeros(134,3);x=sigma;
R(:,1)= polyval(P(1,:),x);
R(:,2)= polyval(P(2,:),x);
R(:,3)= polyval(P(3,:),x);
If a create a matrix by manually entering same value , polyval() return bad value between -38 and 64, i don't understand why.
P2=[-1.9563e-10 8.8342e-7 -0.0015 1.0858 -296.2330;
4.8228e-10 -2.0601e-6 0.0033 -2.2701 585.5897;
-3.7439e-10 1.7088e-6 -0.0029 2.1705 -602.1542;];
  2 件のコメント
David Young
David Young 2015 年 1 月 5 日
Maybe the values are different. What do you see with
disp(P - P2);
?
dpb
dpb 2015 年 1 月 5 日
編集済み: dpb 2015 年 1 月 5 日
No way we can tell; you don't show any variable x in the first loop and we don't have your raw data.
But, polyval is deterministic with the same inputs, so at_least_one of the inputs to it is different between the two cases.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangePolynomials についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by