Wednesday, November 18, 2009

To perform Circular Convolution

CODE


%x(n)--> Input Sequence% Given-->[1 2 4]
%h(n)--> Impulse Response% Given-->[1 2]
clc
clear all
close all

x=input('Enter x(n) : = ');
h=input('Enter h(n) := ');

N1=length(x);
N2=length(h);
N=max(N1,N2);

y=conv(x,h); %stores value according to linear conv.
ly=length(y);

for i=1:1:N
if(N+i<=ly)
r(i)=y(i)+y(N+i);
else
r(i)=y(i);
end
end
disp(r)

No comments:

Post a Comment