Vous êtes sur la page 1sur 9

1

World University of Bangladesh

Department of Mechatronics Engineering


Course no: MTE-1107
Course Name: Digital Signal Processing

LAB REPORT

Submitted To: Submitted By:


Rezwan Us Saleheen Name: Md. Jubaer Ahmed Shuvo
Lecturer Registration No: WUB 11/16/36/1368
Dept. of Mechatronics Engineering Semester: 10th
World University Of Bangladesh Batch No: 36-C
2

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

Experiment Name: Introduction to MATLAB

Objective: To know about the function and how to plot them

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

The MATLAB command to plot a graph is plot(x,y).


The vectors x = (1,2,3,4,5,6)
and y = (3,-1,2,4,5,1) produce the picture shown in Figure 1

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

Experiment Name: Basic Plotting

Objective: To know the code and plot different graphs

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:

Figure 1: Plot for the vector x and y


Conclusion: To put it in a nutshell, it can be said that we learnt how to plot vector x and y.
5

Experiment No: 03

Experiment Name: Generating Sine Wave

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:

Figure 2: Sine wave

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:

Figure 3: sine and cosine wave in same graph

Conclusion: Finally, we learnt about a new code subplot which enables us to plot two waves in
same graph.
7

Experiment No: 04

Experiment Name: Generating Multiple Data Set in One Plot

Objective: To know how to get multiple data set in one graph

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:

Figure 4: Multiple data set in one graph

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

Experiment Name: multiple graph in one plot

Objective: To know about how to plot different graph in single plot

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:

Figure 5: Multiple Graph in one plot

Conclusion: finally, we learnt about few new function and got 4 graph with different pera meter.
9

Experiment No: 06

Experiment Name: Data interpretation

Objective: To know about how to plot signal data.

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:

Figure 6: plotting discrete and continuous data

Conclusion: At the end, we get to know how to write and plot data in matlab.

Vous aimerez peut-être aussi