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');
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 :-
Output :-
IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.
GOOD LUCK
No comments:
Post a Comment