x = 1:5';
y = [4; 9; 2; 3; -3];
plot(x, y, '--b*');
title('data points');
ylim([-4,12]);
saveas(gcf, 'interp_data_points.png');

xq = 1:0.1:5';

% ‹æ•ª�üŒ`•âŠÔ
yq = interp1(x, y, xq);
plot(xq, yq, x, y, 'b*');
title('linear interpolation');
ylim([-4,12]);
saveas(gcf, 'interp_piecewise_linear.png');

% ƒXƒvƒ‰ƒCƒ“•âŠÔ
yq = interp1(x, y, xq, 'spline');
plot(xq, yq, x, y, 'b*');
title('spline interpolation');
ylim([-4,12]);
saveas(gcf, 'interp_spline.png');

