Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

%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; r=reshape([reshape(h,1,H),zeros(1,P*MH)],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');

You might also like