www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/OneDimensionalInterpolationExample.m
%% 1-D Interpolation % Copyright 2015 The MathWorks, Inc. %% % Define the sample points and values. x = [1 2 3 4 5]; v = [12 16 31 10 6]; %% % Define the query points, |xq|, and interpolate. xq = (1:0.1:5); vq = interpn(x,v,xq,'cubic'); %% % Plot the result. figure plot(x,v,'o',xq,vq,'-'); legend('Samples','Cubic Interpolation');