Wednesday, 22 August 2012

dsp ;program


PROGRAM:
%Program for computing convolution and m-fold decimation by polyphase
decomposition.
clear all;
clc;
close all;
x=input(‘enter the input sequence’);
h=input(‘enter the FIR filter coefficients’);
M=input(‘enter the decimation factor’);
N1=length(x);
N=0:1:N1-1;
Subplot(2,1,1);
Stem(n,x);
Xlabel(‘time’);
Ylabel(‘amplitude’);
Title(‘X sequence response’);
N2=length(h);
n=0:1:N2-1;
Subplot(2,1,2);
Stem(n,h);
Xlabel(‘time’);
Ylabel(‘amplitude’);
Title(‘H sequence response’);
H=length(h);
P=floor((H-1)/M)+1;EC 56-Digital Signal Processing Lab
©Einstein College of Engineering
Page 37 of 81
r=reshape([reshape(h,1,H),zeros(1,P*M-H)],M,P);
X=length(x);
Y=floor((X+H-2)/M)+1;
U=floor((X+M-2)/M)+1;
R=zeros(1,X+P-1);
for m=1:M
   R=R+conv(x(1,:),r(m,:));
End
Disp(R);
N=length(R);
n=0:1:N-1;
figure(2);
stem(n,R);
xlabel(‘time’);
ylabel(‘amplitude’);
title(‘Decimation of polyphase decomposition sequence response’)