checking script's output
显示 更早的评论
Hi all,
i've uesd those two code in a script to fit a polynomial on my data.the evauation output(command: polyval2(P,x,y))tells us,it's a good fit but when i made the equation with coefficients which produced by P = polyfitweighted2(x,y,z,9,w)i couldn't reach to that evaluated point( tested at specific point)which is produced by the coomand polyval2(P,x,y).i would like to ask somebody plz help me to find how could i get to a evaluated point through equation at a point???
link for two functions :
http://www.mathworks.com/matlabcentral/fileexchange/13719-2d-weighted-polynomial-fitting-and-evaluation
my script:
BoverH=1:8;
phi=0:10:30;
mydata = [ 1 1.02 1.11 1.21 1.3 1.4 1.59 1.78; ...
1 1.11 1.35 1.62 1.95 2.33 3.34 4.77; ...
1.01 1.39 2.12 3.29 5.17 8.29 22 61; ...
1.13 2.5 6.36 17.5 50 150 1400 14800];
h=log(mydata);
y=phi;
x=BoverH;
z=h;
w=ones(size(z));
P = polyfitweighted2(x,y,z,9,w);
[c, hh]=contour(x,y,z); clabel(c,hh), colorbar
title('data')
figure
[c, hh]=contour(x,y,polyval2(P,x,y)); clabel(c,hh), colorbar
title('equal weight')
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Polynomials 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!