clear clc close all x =[ 0 .8 2.3 3 3.9 5.2 6]; y = [-.2 -2 2.6 3.5 3.3 5.1 7.9]; plot(x, y, 'r+') %axis([-1 7 -1 9]) interp1(x, y, 1.5) interp1(y, x, 5) xp = -1:.1:7 yp = interp1(x, y, xp) hold on plot(xp, yp, 'gs') ysp = spline(x, y, xp); plot(xp, ysp)