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

    %% Interpolate a Sinusoid With Linear Interpolation
%%
% *Note*: This example runs only in R2016b or later. If you are using an
% earlier release, replace each call to the function with the equivalent
% |step| syntax. For example, myObject(x) becomes step(myObject,x).

%%
t = 0:.0001:.0511;
x = sin(2*pi*20*t);
x1 = x(1:50:end);
I = 1:0.1:length(x1);
H = dsp.Interpolator('InterpolationPointsSource',...
    'Input port');
y = H(x1',I');
stem(I',y, 'r');
title('Original and Interpolated Signal');
hold on; stem(x1, 'Linewidth', 2);
legend('Interpolated','Original');