Sunday, 28 October 2012

Program for Addition & Subtraction of two signals

Here is a program of MAT LAB for addition & subtraction of two signals 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.005:n;
f=1;


x=sin(2*pi*f*t);
y=cos(2*pi*f*t);
z=x+y;
z1=x-y;


subplot(321);
plot(t,x);
ylabel('amp.');
xlabel('time');
title('cont. sine wave');


subplot(322);
plot(t,y);

ylabel('amp.');
xlabel('time');
title('cont. cosine wave');


subplot(323);
plot(t,z);
ylabel('amp.');
xlabel('time');
title('cont. addition wave');


subplot(324);
plot(t,z1);
ylabel('amp.');
xlabel('time');
title('cont. subtraction wave');


subplot(325);
stem(t,z);
ylabel('amp.');
xlabel('time');
title('dis. addition wave');


subplot(326);
stem(t,z1);
ylabel('amp.');
xlabel('time');
title('dis. subtraction wave');

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

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>>...


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>>...