MATLAB CODE TO DOWN-SAMPLE THE INPUT SIGNAL.

CODE:


N=input('enter the length of input');
L=input('down sampling factor');
f=input('enter the input signal freq.');

n=0:N-1;
m=0:N*L-1;
x=sin(2*pi*f*m);
y=x(1:L:length(x));


subplot(2,1,1);
stem(m,x);
title('input seq.');
xlabel('time index n');
ylabel('amplitude');

subplot(2,1,2);
stem(n,y);
title('down sampled seq.');
xlabel('time index n');
ylabel('amplitude');

OUTPUT:

enter the length of input10
down sampling factor2
enter the input signal freq.0.15


0 comments:

Post a Comment