simple, linear and cubic calculation for plot

matlab code for spline and cubic plot

Sie verfolgen jetzt diese Einreichung

For the given x-y data points in table below, use linear, spline and cubic interpolation methods to calculate the value of y. Plot data points and graphs of three interpolation methods on the same figure. Find the value of y for x=7 using three interpolation methods.
x=1:5;
y=[0.8530 0.6221 0.3510 0.5132 0.4018];
x2=1:0.01:10;
ylin=interp1(x,y,x2,'linear');
yspl=interp1(x,y,x2,'spline');
ycub=interp1(x,y,x2,'cubic');
plot(x2,ylin,'r',x2,yspl,'k',x2,ycub,'s');
fprintf('at x=7 value:\n');
fprintf('linear: %f\n spline: %f\n cubic: %f',ylin(7),yspl(7),ycub(7));

Zitieren als

Arthur Matlabus (2026). simple, linear and cubic calculation for plot (https://de.mathworks.com/matlabcentral/fileexchange/167331-simple-linear-and-cubic-calculation-for-plot), MATLAB Central File Exchange. Abgerufen .

Add the first tag.

Allgemeine Informationen

Kompatibilität der MATLAB-Version

  • Kompatibel mit allen Versionen

Plattform-Kompatibilität

  • Windows
  • macOS
  • Linux
Version Veröffentlicht Versionshinweise Action
1.1.0

change

1.0.0