use linear, spline and cubic interpolation methods to calculate the value of y. Plot data points and graphs of three interpolation methods.Estimate the value of y for x = 7.5 using three interpolation methods. displayyour results along with text which technique was used to produce each value.
x = [10 20 30 40 50];y = [0.9530 0.7221 0.4510 0.6132 0.5518];
this is what I got, but I do not know if it any correct
x = [10 20 30 40 50];y = [0.9530 0.7221 0.4510 0.6132 0.5518];plot(x,y,'ob')xi=1:0.1:10;method=char('linear','cubic','spline');col={'--r',':g','-k'};for k=1:3 yi{k}=interp1(x,y,xi,method(k,:)); hold on; plot(xi,yi{k},col{k})endlegend('linear','cubic','spline', 'Location', 'best');title(sprintf('x = 7.5 y is %.2f ',polyval(fit,7.5)))y1=yi{1};y2=yi{2};y3=yi{3};
Best Answer