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

    %% Interpolate a Signal
% Create a sinusoidal signal sampled at 1 kHz. Interpolate it by a factor
% of four.

% Copyright 2015 The MathWorks, Inc.


%%
t = 0:0.001:1;
x = sin(2*pi*30*t) + sin(2*pi*60*t);
y = interp(x,4);

%%
% Plot the original and interpolated signals.

subplot 211
stem(0:30,x(1:31),'filled','markersize',3)
grid on
xlabel 'Sample number',ylabel Original
subplot 212
stem(0:120,y(1:121),'filled','markersize',3)
grid on
xlabel 'Sample number',ylabel Interpolated