EC-506 Scilab Laboratory Manual: Submitted by
EC-506 Scilab Laboratory Manual: Submitted by
SUBMITTED BY:
ASHUTOSH YADAV
EC-V-A (2019-2023)
Enroll. No.-0103EC191057
SUBMITTED TO:
EXP. NO 1
To write scilab Code to perform Basic Operations.
Sol:
-> %pi
%pi =
3.1415927
--> %e
%e =
2.7182818
--> %pi/2
ans =
1.5707963
p =
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
2. 4. 6.
6. 7. 8.
1. 2. 4.
q =
1. 2. 3.
3. 5. 8.
5. 6. 7.
--> z=p+q
z =
3. 6. 9.
9. 12. 16.
6. 8. 11.
--> z=p-q
z =
1. 2. 3.
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
3. 2. 0.
--> z=p*q
z =
--> z=p/q
z =
2. -3.331D-16 8.327D-17
-0.75 1. -0.25
-->det(p)
ans =
-10.000000
-->inv(p)
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
ans =
-1.2 0.4 1.
-0.5 9.252D-18 1.
-->factorial(5)
ans =
120.
x =
-->lcm(x)
ans =
7140.
-->gcd(x)
ans =
5.
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
-->mean(x)
ans =
60.
EXP. NO. 2
Q2.)To write the program for unit Step Discrete Signal and
Unit Step Continuous Signal.
Sol:
-> t=0:4;
--> y=ones(1,5);
-->subplot(2,1,1);
-->plot2d3(t,y);
-->xlabel('Time');
-->ylabel('Amplitude');
-->subplot(2,1,2);
-->plot(t,y);
-->xlabel('Time');
-->ylabel('Amplitude');
( P.T.O)
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
EXP. NO. 3
To write the program of Unit Ramp Discrete Signal, Exponential Discrete Signal , Unit Ramp Continuous
Signal and Exponential Continuous Signal.
Sol:
n1=0:8;
--> y1=n1;
--> y2=exp(n1);
-->subplot(2,2,1);
-->plot2d3(n1,y1);
-->xlabel('Time');
-->ylabel('Amplitude');
-->subplot(2,2,2);
-->plot2d3(n1,y2);
-->xlabel('Time');
-->ylabel('Amplitude');
-->subplot(2,2,3);
-->plot(n1,y1);
-->xlabel('Time');
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
-->ylabel('Amplitude');
-->subplot(2,2,4);
-->plot(n1,y2);
-->xlabel('Time');
-->ylabel('Amplitude');
EXP. NO. 4
To generate signal shifting ,folding ,addition & multiplication
PROGRAM:
n1=0:6; y1=[zeros(1,3),ones(1,4)];
y2=n1-2; y3=n1+2;
y4=n1; y5=y1+y2;
y6=y3.*y4;
subplot(3,2,1);
plot2d3(n1,y1);
xlabel('time');
ylabel('amplitude');
title('sample signal');
subplot(3,2,2);
plot2d3(n1,y2);
xlabel('time');
ylabel('amplitude');
subplot(3,2,3);
plot2d3(n1, y3);
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
xlabel('time');
ylabel('amplitude');
subplot(3,2,4);
plot2d3(n1,y4);
xlabel('time');
ylabel('amplitude');
title('folded signal');
subplot(3,2,5);
plot2d3(n1,y5);
xlabel('time');
ylabel('amplitude');
title('addition of signal');
subplot(3,2,6) plot2d3(n1,y6);
xlabel('time');
ylabel('amplitude');
title('multiplication of signal');
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
EXP. NO. 5
AIM: To write the scilab code for addition and subtraction of a two given signal (continuous and discrete
domain).
PROGRAM:
n1=0:10;
y1=[ones(1,5),zeros(1,6)];
y2=[zeros(1,3),ones(1,4),zeros(1,4)];
plot2d3(n1,y1);
xlabel('time');
ylabel('amplitude');
title('1st signal');
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
subplot(2,3,2);
plot2d3(n1,y2);
xlabel('time');
ylabel('amplitude');
title('2nd signal');
subplot(2,3,3);
plot2d3(n1,y3);
xlabel('time');
ylabel('amplitude');
subplot(2,3,4);
plot(n1,y3);
xlabel('time');
ylabel('amplitude');
subplot(2,3,5); plot2d3(n1,y4);
xlabel('time');
ylabel('amplitude');
subplot(2,3,6);
plot(n1,y4);
xlabel('time');
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
ylabel('amplitude');
output
( p.t.o.)
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
EXP. NO. 6
AIM: To write scilab code for sine and cosine wave.
b=(0:%pi/100:6*%pi);
x=sin(b);
subplot(2,1,1);
xlabel('time');
ylabel('amplitude');
title('sine wave');
plot(b,x);
subplot(2,1,2);
y=cos(b);
xlabel('time');
ylabel('amplitude');
title('cosine wave');
plot(b,y);
output-
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
EXP NO 7.
AIM: To write scilab code to show marks of 10 students in bar graph.
PROGRAM:
x=[1:10];
y=[75,58,90,87,25,85,92,42,60,95];
bar(x,y); xlabel('student');
ylabel('marks');
OUTPUT:
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
EXP. NO. 8
AIM: To write scilab code to plot frequency modulated signal.
PROGRAM:
t=0:0.0001:1;
fm=5;
fc=40;
mi=5;
sm=sin(2*%pi*fm*t);
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
subplot(3,1,1);
plot(t,sm);
xlabel('time');
ylabel('amplitude');
sc=sin(2*%pi*fc*t);
subplot(3,1,2);
plot(t,sc,'g');
xlabel('time');
ylabel('amplitude');
title('carrier signal');
y=sin(2*%pi*fc*t+(mi.*sin(2*%pi*fm*t)));
subplot(3,1,3);
plot(t,y,'r');
xlabel('time');
ylabel('amplitude');
OUTPUT:
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
EXP. NO. 9
AIM: To write scilab code to plot an amplitude modulated signal
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
t=0:0.0001:1;
-->vm=8;
-->vc=10;
-->fm=2;
-->fc=100;
-->sm=vm*sin(2*%pi*fm*t);
-->subplot(3,1,1);
-->plot(t,sm);
-->xlable('time');
-->xlabel('time');
-->ylabel('amplitude');
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
-->sc=vc*sin(2*%pi*fc*t);
-->subplot(3,1,2);
-->plot(t,sc,'g');
-->xlabel('time');
-->ylabel('amplitude');
--> y=(vc+vm*sin(2*%pi*vm*t)).*(sin(2*%pi*fc*t));
-->subplot(3,1,3);
-->plot(t,y,'r');
-->xlabel('amplitude');
-->xlabel('time');
-->ylabel('amplitude');
Output-
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
EXP. NO. 10
AIM: To write scilab code to plot phase modulated signal.
t=0:0.0001:1;
-->vm=1;
-->vc=1;
-->fm=10;
-->fc=25;
--> m=1;
-->sm=vm*sin(2*%pi*fm*t);
-->subplot(3,1,1);
-->plot(t,sm);
-->xlabel('time');
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
-->ylabel('amplitude');
-->sc=vc*sin(2*%pi*fc*t);
-->subplot(3,1,2);
-->plot(t,sc);
-->xlabel('time');
-->ylabel('amplitude');
-->title('carrier signal');
--> y=vc*sin(2*%pi*fc*t+m.*sin(2*%pi*fm*t));
-->subplot(3,1,3);
-->plot(t,y,'r');
Lakshmi Narain College of Technology, Bhopal
Department of Electronic and Communication Engineering
Name ASHUTOSH YADAV Enrollment no:0103EC191057 Class:EC
V‘A’(2019-23)
-->xlabel('time');
-->ylabel('amplitude');