Sunday, 28 October 2012

Program for Convolution of two signals

Here is a program for convolution of two signals in MAT LAB in continuous and discreet form.

open MAT LAB open new script and paste this program :-

Program :-

-----------------------------------------------------------------------------------------------------------------------


n=input('enter the value of n=');
t=0:0.02:n;
f=1;

x1=sin(2*pi*f*t);
subplot(321);
plot(t,x1);
ylabel('amp.');
xlabel('time');
title('cont. sine wave');


subplot(323);
stem(t,x1);
xlabel('time');
ylabel('amp.');
title('dis. sine wave');

y1=cos(2*pi*f*t);
subplot(322);
plot(t,y1);
xlabel('time');
ylabel('amp.');
title('cont. cosine wave');

subplot(324);
stem(t,y1);
xlabel('time');
ylabel('amp.');
title('dis. cosine wave');

z1=conv(x1,y1);
subplot(325);
plot(z1);
xlabel('time');
ylabel('amp.');
title('cont. time convolution');

subplot(326);
stem(z2);
xlabel('time');
ylabel('amp.');
title('dis. time convolution');

-----------------------------------------------------------------------------------------------------------------------

just paste the program, press run, enter the value of 'n' (numerical). get output :-

Output :-

IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...




No comments: