Here is a program of MAT LAB for displaying elementary signals like sine and cosine waves 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;
x=sin(2*pi*f*t);
subplot(221);
plot(t,x);
ylabel('amp.');
xlabel('time');
title('cont. sine wave');
subplot(222);
stem(t,x);
xlabel('time');
ylabel('amp.');
title('dis. sine wave');
y=cos(2*pi*f*t);
subplot(223);
plot(t,y);
xlabel('time');
ylabel('amp.');
title('cont. cosine wave');
subplot(224);
stem(t,y);
xlabel('time');
ylabel('amp.');
title('dis. cosine wave');
-----------------------------------------------------------------------------------------------------------------------
just paste the program, press run, enter the value of 'n' (numerical). get output :-
Output :-
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;
x=sin(2*pi*f*t);
subplot(221);
plot(t,x);
ylabel('amp.');
xlabel('time');
title('cont. sine wave');
subplot(222);
stem(t,x);
xlabel('time');
ylabel('amp.');
title('dis. sine wave');
y=cos(2*pi*f*t);
subplot(223);
plot(t,y);
xlabel('time');
ylabel('amp.');
title('cont. cosine wave');
subplot(224);
stem(t,y);
xlabel('time');
ylabel('amp.');
title('dis. cosine 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
No comments:
Post a Comment