You are on page 1of 2

Program to study interpolation & decimation

clc; % Clear the command window f1=50; f2=100; fs=1000; a=1; b=2; t=0:(1/fs):1; A=a*cos(2*pi*f1*t)+b*cos(2*pi*f2*t); % To Plot the original signal subplot(3,1,1) stem(A(1:30)) title('Original i/p signal') xlabel('time') ylabel('Amp') % To obtain the interpolated signal using the inbuilt function m=interp(A,2); subplot(3,1,2) stem(m(1:30)) title('Interpolated signal') xlabel('Discrete time') ylabel('Amp') % To obtain decimated signal using the inbuilt function b=decimate(A,2); subplot(3,1,3) stem(b(1:30)) title('Decimated signal') xlabel('Discrete time') ylabel('Amp')

FIGURE WINDOW

You might also like