Académique Documents
Professionnel Documents
Culture Documents
LAB REPORT
CONTENT
Table of Contents
Experiment 01 .............................................................................................................................................. 3
Experiment 02 .............................................................................................................................................. 4
Experiment 03 .............................................................................................................................................. 5
Experiment 04 .............................................................................................................................................. 7
Experiment 05 .............................................................................................................................................. 8
Experiment 06 .............................................................................................................................................. 9
3
Experiment No: 01
Theory:
Variables
X.Y,Z….
Elementary Function:
cos(x) Cosine
sin(x) Sine
tan(x) Tangent
acos(x) Arc cosine
asin(x) Arc sine
atan(x) Arc tangent
exp(x) Exponential
sqrt(x) Square root
log(x) Natural logarithm
log10(x) Common logarithm
abs(x) Absolute value
sign(x) Signum function
max(x) Maximum value
min(x) Minimum value
ceil(x) Round towards +1
floor(x) Round towards ¡1
round(x) Round to nearest integer
rem(x) Remainder after division
angle(x) Phase angle
conj(x) Complex conjugate
Predefined constant:
pi The ¼ number, 𝜋 = 3:14159….
i,j The imaginary unit i,
Inf The infinity, 1
NaN Not a number
4
>> x = [1 2 3 4 5 6];
>> y = [3 -1 2 4 5 1];
>> plot(x,y)
Conclusion: At the end of this experiment we learnt about the elementary function and how to
plot graph in MATLAB.
Experiment No: 02
Theory:
Code:
>> x = [1 2 3 4 5 6];
>> y = [3 -1 2 4 5 1];
>> plot(x,y)
To plot the function sin (x) on the interval [0, 2 𝜋], we first create a vector of
x values ranging from 0 to 2 𝜋, then compute the sine of these values, and finally plot the
result:
Experiment No: 03
Objective: To know about the sine function and how to generate graph
Theory;
Code:
>> xlabel('x = 0:2\pi')
>> ylabel('Sine of x')
>> title('Plot of the Sine function')
Result:
Code:
clc;
clf;
clear all;
x = 0:pi/100:4*pi;
y = cos(x);
m = sin(x);
subplot(2,1,1)
plot(x,y)
xlabel('x = 0:\pi')
ylabel('cosine of the x')
title('plot of the cosine wave')
subplot(2,1,2)
plot(x,m)
xlabel('x= 0:2\pi')
ylabel('sine of the x')
title('plot of the sine wave')
6
Result:
Conclusion: Finally, we learnt about a new code subplot which enables us to plot two waves in
same graph.
7
Experiment No: 04
Theory:
Code:
x = 0:pi/100:2*pi;
y1 = 2*cos(x);
y2 = cos(x);
y3 = 0.5*cos(x);
plot(x,y1,'--',x,y2,'-',x,y3,':')
xlabel('0 \leq x \leq 2\pi')
ylabel('Cosine functions')
legend('2*cos(x)','cos(x)','0.5*cos(x)')
title('Typical example of multiple plots')
axis([0 2*pi -3 3])
Result:
Conclusion: At the end of this experiment we get to know, how to plot the multiple data set in
one plot.
8
Experiment No: 05
Theory:
Code:
x = 1:6
y = [33 11 5 9 22 30];
subplot(2,2,1)
bar(x,y)
title('bar')
subplot(2,2,2)
barh(x,y)
title('barh')
subplot(2,2,3)
area(x,y)
title('area')
subplot(2,2,4)
stem(x,y)
title('stem')
Result:
Conclusion: finally, we learnt about few new function and got 4 graph with different pera meter.
9
Experiment No: 06
Theory:
Code:
ti = 0;
tf = 0.05;
t = ti:0.00005:tf;
f = 50;
xt = cos(2*pi*f*t);
fs1 = 1.3*f;
t1 = ti:1/fs1:tf;
xt1 = cos(2*pi*t1);
subplot(3,1,1)
plot(t,xt,'b',t1,xt1,'r*-');
fs2=2*f
t2 = ti:1/fs2:tf;
xt2 = cos(2*pi*f*t2);
subplot(3,1,2)
plot(t,xt,'b',t2,xt2,'r*-');
fs3 = 15*f;
t3 = ti:1/fs3:tf;
xt3 = cos(2*pi*f*t3);
subplot(3,1,3)
plot(t,xt,'b',t3,xt3,'r*-')
Result:
Conclusion: At the end, we get to know how to write and plot data in matlab.