Hi,
i want to use polyfit in my project and write the following short code.
cooefs = [346.355000, -53.370100, 74.800800, -15.380000];polyDegree = 5;cooefs_w_0 = [0, cooefs];xVals = (0:.01:95)/180*pi;yVals = polyval(cooefs_w_0(end:-1:1), xVals);[p,~,mu] = polyfit(yVals, xVals, polyDegree);p(end) =0;figure;hold on;plot(xVals/pi*180, yVals);xlabel('Field angle [°]');ylabel('Radius [px]');hold all;plot(polyval(p, yVals/mu(2))/pi*180, yVals,'o');legend('Original','Fitting');
But the Fitting are not right. Why polyfit not work on Matlab?? Or have I done an misstake in my code?
Right of the Image are my Plot!!
Thanks for all Answer.
Best Answer