Blogger Widgets

Monday 30 April 2012

Circular Convolution of two Sequences

MATLAB CODE:-
clc
close all
clear all
x=input('Enter the sequence x:');
h=input('Enter the sequence h:');
subplot(3,1,1);
stem(x);
xlabel('--->n');
ylabel('Amp');
legend('Input Sequence');


subplot(3,1,2);
stem(h);
xlabel('--->');
ylabel('Amp');
legend('Impulse Responce');

lx=length(x);
lh=length(h);
l=max(lx,lh);
x=[x,zeros(1,l-lx)];
h=[h,zeros(1,l-lh)];
H=zeros(l,l);
H(1:lh,1)=h;
for j=1:l-1
    for i=1:l-1
        H(i+1,j+1)=H(i,j);
    end
        H(1,j+1)=H(l,j);
end
y=H*x';
subplot(3,1,3);
stem(y);
title('Circular Convulation');

INPUT & OUTPUT:-
Enter the sequence x:[1 -1 2 3]
Enter the sequence h:[1 -2 3 1]
>> y

y =

     0
     8
    10
    -3

FIGURE:-


0 comments

Post a Comment