www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/InterpolationWithoutSpecifyingPointsExample.m

    %% Interpolation Without Specifying Points  

% Copyright 2015 The MathWorks, Inc.


%% 
% Define a set of function values. 
v = [0  1.41  2  1.41  0  -1.41  -2  -1.41 0];  

%% 
% Define a set of query points that fall between the default points, |1:9|.
% In this case, the default points are |1:9| because |v| contains |9| values. 
xq = 1.5:8.5;  

%% 
% Evaluate |v| at |xq|. 
vq = interp1(v,xq);  

%% 
% Plot the result. 
figure
plot((1:9),v,'o',xq,vq,'*');
legend('v','vq');