Polyval and polyfit calculate - 2.75

calculate polyval and polyfit values
7 Downloads
Updated 3 Jun 2024

View License

Interpolate x-y data points in the table below by the lowest degree polynomial. Determine the coefficients of the polynomial and y values for x= 2.75 and x=4.85. Plot the polynomial.
x=1:0.5:5;
y=[0.2919,0.0050, 0.1732, 0.6418, 0.9801, 0.8770,0.4272,0.0444,0.0805];
p=polyfit(x,y,8);
x2=1:0.5:5;
y2=polyval(p,x2);
plot(x,y,'r',x2,y2,'k');
fprintf('at x=2.75 value:%f\n',polyval(p,2.75));
fprintf('at x=4.85 value:%f\n',polyval(p,4.85));

Cite As

Arthur Matlabus (2026). Polyval and polyfit calculate - 2.75 (https://www.mathworks.com/matlabcentral/fileexchange/167341-polyval-and-polyfit-calculate-2-75), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Version Published Release Notes
1.1.0

change

1.0.0