%% Interpolate a Sinusoid with Linear Interpolation
% Note: If you are using R2016a or earlier, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes step(obj,x).

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

% Copyright 2012 The MathWorks, Inc.