Monday, April 18, 2011
2
matlab program for circular convolution matlab code for convolution matlab code for circular convolution
circular convolution using matlab
%circular convolution
a=input('enter first sequence');
b=input('enter second sequence');
l1=length(a);
l2=length(b);
N=max(l1,l2);
a=[a zeros(N-l1)];
b=[b zeros(N-l2)];
for n=0:N-1
y(n+1)=0;
for i=0:N-1;
j=mod(n-i,N);
y(n+1)=y(n+1)+a(i+1)*b(j+1);
end
end
disp(y);
x=1:N;
stem(x,y);
input
enter first sequence[2 1 2 1]
enter second sequence[1 2 3 4]
%circular convolution
a=input('enter first sequence');
b=input('enter second sequence');
l1=length(a);
l2=length(b);
N=max(l1,l2);
a=[a zeros(N-l1)];
b=[b zeros(N-l2)];
for n=0:N-1
y(n+1)=0;
for i=0:N-1;
j=mod(n-i,N);
y(n+1)=y(n+1)+a(i+1)*b(j+1);
end
end
disp(y);
x=1:N;
stem(x,y);
input
enter first sequence[2 1 2 1]
enter second sequence[1 2 3 4]
output
tags: matlab program for circular convolution matlab code for convolution matlab code for circular convolution circular convolution using matlab
This post was written by: noufel n backer
Subscribe to:
Post Comments (Atom)
2 Responses to “matlab program for circular convolution matlab code for convolution matlab code for circular convolution”
May 16, 2011 at 2:39 AM
x=input('enter first sequence')
y=input('enter second sequence')
a=length(x);
b=length(y);
n=max(a,b);
c=cconv(x,y,n)
figure
stem(c)
xlabel('---->n')
ylabel('---->Y')
title('circular convolution')
siple program this is.
May 17, 2011 at 2:45 AM
yepp...but my program is without using function.if you use function it will be much simpler!
Post a Comment