0% found this document useful (0 votes)
154 views49 pages

Premier University: Dept. of CSE Lab Report

The document provides a lab report submitted by Md. Shahiduzzaman Bhuiyan for their Signal and System Laboratory course. The report describes 5 experiments conducted in MATLAB: 1) Familiarization with MATLAB functions, 2) Matrix operations in MATLAB, 3) Plotting various signals in MATLAB, 4) Plotting more signal types using sawtooth, ramp, and impulse functions, 5) Solving differential equations in MATLAB. Code snippets and figures are included for each experiment conducted.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
154 views49 pages

Premier University: Dept. of CSE Lab Report

The document provides a lab report submitted by Md. Shahiduzzaman Bhuiyan for their Signal and System Laboratory course. The report describes 5 experiments conducted in MATLAB: 1) Familiarization with MATLAB functions, 2) Matrix operations in MATLAB, 3) Plotting various signals in MATLAB, 4) Plotting more signal types using sawtooth, ramp, and impulse functions, 5) Solving differential equations in MATLAB. Code snippets and figures are included for each experiment conducted.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 49

Premier University

Dept. of CSE
Lab Report

Course Code : EEE 202


Course Title : Signal and System Laboratory
Report Name : Familiarization with MATLAB and
Functions in MATLAB
Report No : 01
Submission Date : 05.10.2021

SUBMITTED BY

Name: Md. Shahiduzzaman Bhuiyan


Remarks
Id: 1803510201685
Department: CSE
Year: 2021
Semester: 4th
Section: B2
1. Experiment no: 01
1

2. Experiment name:
Familiarization with MATLAB
and Functions in MATLAB.
3. Objectives: To be familiar
with MATLAB.

4. Software: MATLAB 2016

5. Step of solving problems:


First we set two variables a and
b and assigned their values.
Then we added them. T hen we
assigned a square matrix and
implemented the invers
function.

6. Code: Script-
a= 1;
b = 5;
addition = a+b;

Script-
c=[1 2; 3 4]
c=
1 2
3 4
>> d= inv(c);
>> d d =

-2.0000 1.0000
1.5000 -0.5000
7. Figure:
2

Figure:01

Figure:02

9. Discussion:
It was the first day we were using MATLAB software. Firstly, we took two variables a and b than adder them
and executed the them. And for the second problem we took a variable and assigned a square matrix. Then used
inverse function. We are now able to use the MATLAB software properly.
3

Premier University

Dept. of CSE
Lab Report

Course Code : EEE 202 Course Title : Signal


and System Laboratory Report Name : Observation of
Matrix operations in MATLAB Report No : 02
Submission Date : 05.10.2021

SUBMITTED BY

Name: Md. Shahiduzzaman Bhuiyan


Remarks
Id: 1803510201685
Department: CSE
Year: 2021
Semester: 4th
Section: B2
4

1. Experiment no: 01
2. Experiment name:
Observation of Matrix
operations in MATLAB
3. Objectives: To perform matrix
additions, subtractions and
multiplications in MATLAB.

4. Software: MATLAB 2016

5. Step of solving problems:


First we set two variables a and
b and assigned their values as
matrix.
Then we added them.
After that we done the subtraction.
At last, the multiplication function.

6. Code:
a= [1 2 3; 2 3 4; 3 4 5]
b= [5 4 3; 4 3 2; 3 2 1]
Add= a+b;
Sub= a-b;
Mul= a*b;

7. Figure:

Figure:01

9. Discussion:
Here, we are executing the addition, subtraction and multiplication function. These are some normal arithmetic
functions. In MATLAB we can process all the matrix functions properly.
5

Premier University

Dept. of CSE
Lab Report

Course Code : EEE 202 Course Title : Signal


and System Laboratory Report Name : Plotting of
various signals in
MATLAB
Report No : 03 Submission Date : 05.10.2021

SUBMITTED BY

Name: Md. Shahiduzzaman Bhuiyan


Remarks
Id: 1803510201685
Department: CSE
Year: 2021
Semester: 4th
Section: B2
1. Experiment no: 03
6

2. Experiment name: Plotting of


various signals in MATLAB

3. Objectives: To understand the


process of plotting & sub
plotting of different signals in
MATLAB

4. Software: MATLAB 2016

5. Step of solving problems:


1. Firstly, we take the range of x.
2. After that write the given function.
3. Then we use plot function to see the graph.
4. Here, we are using the subplot function to group the graphs in the same figure.

6. Code:
1. Plot the following function y(x) = x^2 , -2 ≥ 0 ≥ 2 x =
-2 : 0.01 : 2; y = x .^ 2; plot(x,y);

2. Plot the y(x) = x^2 cos(x), g(x) = xcos (x) and f(x) =
2^xsin (x), 0 ≤ x ≤ 2π in the same figure x = 0 :
pi/100 : 2*pi; subplot(1, 3, 1); y = (x.^2) .* cos(x);
plot(x,y); subplot(1, 3, 2); g = x .* cos(x); plot(x,g,'r');
subplot(1, 3, 3); f = 2.^(x .* sin(x)); plot(x,f,'--');

3. Plot the discrete function f (n) = n^2, where -2 ≤ x ≤


2 n = -2 : 0.01 : 2; f = n .^ 2;
stem(n,f);
7. Figure:

Figure:01
7

Figure:2

Figure:3
9. Discussion:
Here, three problems are given where we are learning to use plot and subplot making concept using MATLAB
software. In the first program we are implementing a plot with the given range and equation. To solve the second
problem, we have to use 3 subplots here to do the three different equations with the same range. In the last problem we
had to find out a simple plot. We are able to solve these problems properly using MATLAB software.
8

Premier University

Dept. of CSE
Lab Report

Course Code : EEE 202 Course Title : Signal


and System Laboratory Report Name : Plotting of
various signals in
MATLAB
Report No : 04 Submission Date : 05.10.2021

SUBMITTED BY

Name: Md. Shahiduzzaman Bhuiyan


Remarks
Id: 1803510201685
Department: CSE
Year: 2021
Semester: 4th
Section: B2
1. Experiment no: 04
2. Experiment name: Plotting of
various signals in MATLAB
9

3. Objectives: To understand the


process of plotting & sub
plotting of different signals in
MATLAB

4. Software: MATLAB 2016

5. Step of solving problems:


1. Firstly, we learn the use of ylim.
2. After that, we use the sawtooth function. 3. Then we use ramp and
impulse function.
4. At last, we make the plot form the given equation.

5.Code:

1.
t= -10:0.1:10;
unitstep1=t>=0;
unitstep2=t>=6;
x=unitstep1-
unitstep2; plot(t,x)
ylim([-1.5 1.5]) hold
on

2.

T=2*(1/50); fs=1000;
t=0:1/fs:T-1/fs;
x=10*sawtooth(2.*pi*50*t,1/2)
; plot(t,x) hold on

3.

f=50;
OverSampleRate=100;
fs=OverSampleRate.*f
; d1=60; d2=40;
nCycle=2;
t=0:1/fs:nCycle*(1/f);
y1=10.*square(2.*pi.*f.*t,d1);
y2=15.*square(2.*pi.*f.*t,d2);
10

plot(t,y1,'Green','LineWidth',2)
; hold on
plot(t,y2,'red','LineWidth',2);
axis([0 0.1 -15 15]) grid on

4.

A=10; f=50; fs=1000;


x=A*sin(2*pi*(f/fs)*[0.39])
; plot(x)

5.

t=-20:0.1:20
unitstep=t>=0;
impulse=t==0;
ramp=t.*unitstep;
plot(t,unitstep,'green')
hold on
plot(t,impulse,'blue')
hold on
plot(t,ramp,'black')

7. Figure:
11

Figure:01

Figure:2

Figure:3
12

Figure:4

Figure:5
9. Discussion:
In this experiment, five problems are given where we are learning to use sawtooth, ramp and impulse using
concept using MATLAB software. Firstly, we learn the use of ylim. After that, we use the sawtooth function. Then we
use ramp and impulse function. At last, we make the plot form the given equation. For the first problem we found
square shaped signal. In the second program we found a pyramid shaped signal. In the 3 rd plot a rectangle shaped
signal. And 4th and 5th plot are accordingly sin shaped and a unique signal.
13

Premier University

Dept. of CSE
Lab Report

Course Code : EEE 202


Course Title : Signal and System Laboratory
Report Name : Solving of differential equation in
MATLAB
Report No : 05
Submission Date : 05.10.2021

SUBMITTED BY

Name: Md. Shahiduzzaman Bhuiyan


Remarks
Id: 1803510201685
Department: CSE
Year: 2021
Semester: 4th
Section: B2
1. Experiment no: 05
14

2. Experiment name: Solving


of differential equation in
MATLAB.

3. Objectives: To perform
differential operation in
MATLAB.

4. Software: MATLAB 2016

5. Step of solving problems:


5. Firstly, we set syms.
6. After that take the frequency.
7. Then we applied the equation.
8. Next, we do the derivations.
9. Then, we declared linspace.
10. Finally, we found the plot we wanted.

Code:
1.
syms a t; a = 2; y = exp(-a.*t);
y1 = matlabFunction(diff(y));
y2 =
matlabFunction(diff(y,2)); y3
= matlabFunction(diff(y,3)); t
= linspace(0,4*pi,400); a1 =
y1(t); a2 = y2(t); a3 = y3(t);
plot(t,a1,'r',t,a2,'g',t,a3,'b');

2. syms a w t; a = 2; w = 660; y =
exp(-a.*t).*sin(w.*t); y1 =
matlabFunction(diff(y)); y2 =
matlabFunction(diff(y,2)); y3
= matlabFunction(diff(y,3)); t
= linspace(0,6*pi,400); a1 =
y1(t); a2 = y2(t); a3 = y3(t);
plot(t,a1,'b',t,a2,'g',t,a3,'r');

3. syms a w t; a = 2; w = 660; y =
exp(-a.*t).*cos(w.*t); y1 =
matlabFunction(diff(y)); y2 =
matlabFunction(diff(y,2)); y3
= matlabFunction(diff(y,3)); t
= linspace(0,6*pi,400); a1 =
y1(t); a2 = y2(t); a3 = y3(t);
plot(t,a1,'b',t,a2,'g',t,a3,'r');

4. syms w t; w = 60; y =
cos(w.*t);
y1 = matlabFunction(diff(y)); y2
= matlabFunction(diff(y,2)); y3
= matlabFunction(diff(y,3));
t =
0:0.1:6*pi; a1
= y1(t); a2 =
y2(t); a3 =
y3(t);
15

plot(t,a1,'g',t,a2,'r',t,a3,'b');

5. syms w t; w = 60; y =
sin(w.*t); y1 =
matlabFunction(diff(y)); y2 =
matlabFunction(diff(y,2)); y3
= matlabFunction(diff(y,3));
t =
0:0.1:6*pi; a1
= y1(t); a2 =
y2(t); a3 =
y3(t);
plot(t,a1,'g',t,a2,'r',t,a3,'b');

6. syms w t; w = 60; y =
cos(w.*t).*sin(w.*t); y1 =
matlabFunction(diff(y)); y2 =
matlabFunction(diff(y,2)); y3
= matlabFunction(diff(y,3));
t = 0:0.1:6*pi;
a1 = y1(t); a2
= y2(t); a3 =
y3(t);
plot(t,a1,'black',t,a2,'r',t,a3,'b');

7. Figure:

Figure:01
16

Figure:2

Figure:3

Figure:4
17

Figure:5

Figure:6

9. Discussion:
Here, six problems are given where we are learning different equation solving concept using MATLAB
software. In the experiment we are finding 1 st, 2nd and 3rd derivatives of given equations in MATLAB. To do that we
are trying to solve these problems that we are instructed before. In MATLAB, a variable type is the symbolic variable.
A symbolic variable is defined by the command sym and syms. The use of symbolic variables allows the computation
of limits, integrals, derivatives etc. We are able to solve these problems properly using MATLAB software.
18

Premier University

Dept. of CSE
Lab Report

Course Code : EEE 202 Course Title : Signal


and System Laboratory Report Name : Solving of
integral equation in
MATLAB
Report No : 06 Submission Date : 05.10.2021

SUBMITTED BY

Name: Md. Shahiduzzaman Bhuiyan


Remarks
Id: 1803510201685
Department: CSE
Year: 2021
Semester: 4th
Section: B2
Experiment no: 06
Experiment name: Solving of integral equation in MATLAB.
Objectives: To perform integral operation in MATLAB.
19

Software: MATLAB 2016 Code:

1.
(ii) syms a t w; a = 2; w = 60; y =
exp(-a.*t).*sin(w.*t); y1 =
matlabFunction(int(y)); t =
linspace(0,4*pi,400); a1 =
y1(t); plot(t,a1,'r');

(iii) syms a t w; a = 2; w = 60; y =


exp(-a.*t).*cos(w.*t); y1 =
matlabFunction(int(y)); t =
linspace(0,4*pi,400); a1 =
y1(t); plot(t,a1,'black'); grid
on;

(iv) syms t w; w = 60; y =


cos(w.*t); y1 =
matlabFunction(int(y)); t =
-10:0.1:10; a1 = y1(t);
plot(t,a1,'black'); grid on;

(v) syms t w; w = 60; y =


sin(w.*t); y1 =
matlabFunction(int(y)); t =
-10:0.1:10; a1 = y1(t);
plot(t,a1,'black');
grid on;

(vi) syms t w;
w = 60; y=
cos(w.*t).*sin(w.*t); y1 =
matlabFunction(int(y));
t = -5:0.05:5; a1
= y1(t);
plot(t,a1,'black')
; grid on;

(vii) syms t; y = t.^2; y1 =


matlabFunction(int(y)); t =
-10:0.01:10; a1 = y1(t);
plot(t,a1,'black'); grid on;

2.

(i) syms a t; a = 2; y = exp(-a.*t);


y1 = matlabFunction(int(y)); t
= 0:0.01:pi; a1 = y1(t);
plot(t,a1,'black');
grid on;

(ii) syms a t w; a = 2; w = 60; y =


exp(-a.*t).*sin(w.*t); y1 =
matlabFunction(int(y)); t =
20

0:0.01:pi; a1 = y1(t);
plot(t,a1,'black'); grid on

(iii) syms a t w; a = 2; w = 60; y =


exp(-a.*t).*cos(w.*t); y1 =
matlabFunction(int(y)); t =
0:0.01:pi; a1 = y1(t);
plot(t,a1,'black'); grid on;

(iv) syms t w; w = 60; y =


cos(w.*t); y1 =
matlabFunction(int(y)); t =
0:0.1:pi; a1 = y1(t);
plot(t,a1,'black');
grid on;

(v) syms t w; w = 60; y =


sin(w.*t); y1 =
matlabFunction(int(y)); t =
0:0.1:pi; a1 = y1(t);
plot(t,a1,'black'); grid on;

(vi) syms t w; w = 60; y =


cos(w.*t).*sin(w.*t); y1 =
matlabFunction(int(y));
t = 0:0.05:pi; a1
= y1(t);
plot(t,a1,'black')
;
grid on;

(vii) syms t;
y = t.^2;
y1 = matlabFunction(int(y));
t = -10:0.01:10; a1 = y1(t);
plot(t,a1,'black');
grid on;
21

Figure:- 1(i)

Figure:- 1(ii)
22

Figure:- 1(iii)

Figure:- 1(iv)
23

Figure:- 1(v)

Figure:- 1(vi)
24

Figure:- 1(vii)

Figure:- 2(i)
25

Figure:- 2(ii)

Figure:- 2(iii)
26

Figure:- 2(iv)

Figure:- 2(v)
27

Figure:- 2(vi)

Figure:- 2(vii)

Discussion:
Here, we are solving integral problem using MATLAB software in this experiment. To solve these problems, we are
given here some equation. We used int(expr, var) to compute the indefinite integral of expr with respect to the
symbolic scalar variablevar and int(expr,var,a,b) to compute the definite integral of expr with respect to var from a to
If we do not specify it, int uses the default variable determined by symvar. If expr is a constant, then the default
variable is x. We used some other syntax like int(___, Name, Value) and others to solve those integral problem. At last
we found the plot given above in the report.
28

Premier University

Dept. of CSE
Lab Report

Course Code : EEE 202 Course Title : Signal


and System Laboratory Report Name : Evaluation of
convolution integral in MATLAB Report No : 07
Submission Date : 05.10.2021

SUBMITTED BY

Name: Md. Shahiduzzaman Bhuiyan


Remarks
Id: 1803510201685
Department: CSE
Year: 2021
Semester: 4th
29

Section: B2

Experiment no: 07
Experiment name: Evaluation of convolution integral in MATLAB.
Objectives: To perform convolution of continuous time signals.
Software: MATLAB 2016.
Code:
th = 0:0.01:1; tx =
0:0.01:2; h = 1-th;
a = ones(size(tx));
b = conv(x,h);
plot(b);

Figure:

Figure: 01
Discussion:
Here in the experiment we are trying to to perform convolution of continuous time signals.o perform convolution of
continuous time signals. To do this we write a code given above in the report. The impulse response of a linear
timeinvariant system completely specifies the system. More specifically,if the impulse response of a system is known
one can compute the system output for any input signal. We now present on of most important topics in signals and
systems theory. We managed to found a signal plot at last.
30

Premier University

Dept. of CSE
Lab Report

Course Code : EEE 202 Course Title : Signal


and System Laboratory Report Name : Implementing
Fourier transform in
MATLAB
Report No : 08 Submission Date : 05.10.2021

SUBMITTED BY

Name: Md. Shahiduzzaman Bhuiyan


Remarks
Id: 1803510201685
Department: CSE
Year: 2021
Semester: 4th
Section: B2
Experiment no: 08
Experiment name: Implementing Fourier transform in MATLAB
Objectives: To understand and implement the Fourier transform using MATLAB.
31

Software: MATLAB 2016.


Code:
1.
t=[-20:20] a=-
0.10+0.3j; s=exp(a*t);
subplot(3,1,1)
plot(t,real(s))
subplot(3,1,2)
plot(t,imag(s))
S=fft(s) subplot(3,1,3)
plot(t,fftshift(abs(S))

2.

a=input('Width of pulse"');
t=input('Range of pulse:');
s=rectpuls(t,a);
subplot(2,1,1) plot(t,s)
axis([-2 2 0 2 ]) S=fft(s);
subplot(2,1,2)
plot(t,fftshift(abs(S)

3.

t=input('Duration of sinc function:');


s=sinc(3*t); subplot(2,1,1) plot(t,s)
S=fft(s); subplot(2,1,2)
plot(t,fftshift(abs(S)))
32

Figure:

Figure:1

Figure:2
33

Figure:3

Discussion:

In the experiment we are trying to understand and implement the Fourier transform using MATLAB. To do this, we
are given three problems. Here, we used fourier(f,trans_var,eval_point) to compute the Fourier transform of f with
respect to the transformation variable trans_var at the point eval_point.f is used for Symbolic expression, symbolic
function, or vector or matrix of symbolic expressions or functions. Now we are able to do the fourier transformation
using MATLAB.
34

Premier University

Dept. of CSE
Lab Report

Course Code : EEE 202 Course Title : Signal


and System Laboratory Report Name : Implementing
Fourier transform in
MATLAB
Report No : 09 Submission Date : 05.10.2021

SUBMITTED BY

Name: Md. Shahiduzzaman Bhuiyan


Remarks
Id: 1803510201685
Department: CSE
Year: 2021
Semester: 4th
35

Section: B2

Experiment No: 09
Experiment Name: Implementing Laplace transform in MATLAB
Objective: To implementing Laplace transform using MATLAB Software:
MATLAB 2016.

Code:

1
syms a t
a=2

f=exp(-a.*t)
c=laplace(f,t)

syms a t omega
a=2
omega=40 f=exp(-
a.*t).*sin(omega.*t) c=laplace(f,t)

syms t omega
omega=30
f=cos(omega.*t)
c=laplace(f,t)

syms t h b
h=2 b=6
f=sin(h.*b.*t)
c=laplace(f,t)

syms t omega omega=50


f=sin(omega.*t)
c=laplace(f,t)

syms t h b
36

h=2 b=6
f=cos(h.*b.*t)
c=laplace(f,t)

syms t f=t.^2
c=laplace(f,t)

syms stp t
stp=heaviside(t)
c=laplace(stp)

Result Screenshot:

2
37

4
38

6
39

7
40

Discussion:
In this experiment we are approaching to implementing Laplace transform using MATLAB. Here, we used laplace(f,
trans_var, eval_point) to compute the Laplace transform of f with respect to the transformation variable trans_var at
the point eval point. f is used Symbolic expression, symbolic function, or vector or matrix of symbolic expressions or
functions. Trans_var is used as Symbolic variable representing the transformation variable. This variable is often
called the “time variable”. Eval_point is usually used for Symbolic variable or expression representing the evaluation
point. Using these functions, we are now able to solve these problems.
41

Premier University

Dept. of CSE
42

Lab Report

Course Code : EEE 202


Course Title : Signal and System Laboratory
Report Name : Implementing z- transform in
MATLAB
Report No : 10
: 05.10.2021
Submission Date

Remarks
SUBMITTED BY
Name: Md. Shahiduzzaman Bhuiyan
Id: 1803510201685
Department: CSE
Year: 2021
Semester: 4th
Section: B2
Experiment No: 10
Experiment Name: Implementing z- transform in MATLAB
Objective: To implementing z- transform using MATLAB
Software: MATLAB 2016b
Code
1
syms j omega t
f=exp(j.*omega.*t)
c=ztrans(f,t)

2
43

syms h b t
f=sin(h.*b.*t)
c=ztrans(f,t)

3
syms h b t
f=cos(h.*b.*t)
c=ztrans(f,t)

4 syms
omega t
f=sin(omega.
*t)
c=ztrans(f,t)

5 syms
omega t
f=cos(omega.
*t)
c=ztrans(f,t)

6 syms
t f=t
c=ztrans(f,t)

7 syms
t f=t.^2
c=ztrans(f,t)
8 syms stp t
stp=heaviside
(t)
c=ztrans(stp)

Result Screenshot:

1
44

3
45

5
46

6
47

8
48

Discussion:

In the experiment, we are approaching to implementing z- transform using MATLAB. In order to do this, we
are performing some tasks written in the codes of the report. We are using some functions like ztrans(f, trans_index ,
eval_point) to compute the Z-transform of f with respect to the transformation index trans_index at the point
eval_point. trans_index is used for Symbolic variable representing the transformation index. This variable is often
called the “discrete time variable". eval_point is used as Symbolic variable or expression representing the evaluation
point. We written the syntax properly and found the output of the equations given in the experiment.

You might also like