Sunday, 21 October 2012
Circular Convolution in MATLAB
Just create a new file with extension .m and paste the code below in that .m file. Then Run it.
clear all;
clc;
x=input('enter the sequence x(n) : ');
h=input('enter the sequence h(n) : ');
l_x=length(x);
l_h=length(h);
l=max(l_x,l_h);
x=[x,zeros(1,l-l_x)];
h=[h,zeros(1,l-l_h)];
l1=length(x);
m1=length(h);
j=0;
for s=1:1:l1
g(s)=0;
j=j+1;
for i=1:l1
if j<1
j=l1;
end
g(s)=g(s)+x(i)*h(j);
%i=i+1;
j=j-1;
end
end
g
subplot(3,1,1);
stem(x);
xlabel('time');
ylabel('amplitude');
title('original signal x(n)');
subplot(3,1,2);
stem(h);
xlabel('time');
ylabel('amplitude');
title('original signal h(n)');
subplot(3,1,3);
stem(g);
xlabel('time');
ylabel('amplitude');
title('Circular Convoluted Signal');
at
14:22
Labels:
circular,
computer,
convolution,
language,
matlab,
programming,
windows
Posted by
Unknown
![](https://resources.blogblog.com/img/icon18_edit_allbkg.gif)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment