You are on page 1of 12

Heaven’s Light is Our Guide

Rajshahi University of
Engineering & Technology

Department of Electrical & Electronic Engineering

Course No.: EEE 3200

Course Name: Electrical & Electronic Circuit Simulation Sessional

Experiment No.: 01

Experiment Name: Introduction to MATLAB Simulation Tools

Date of Experiment: 27 September, 2022

Date of Submission: 12 October, 2022


Submitted By: Submitted To:

Name: Md. Mehedi Hasan Md. Razon Chowdhury


Roll: 1801165 Assistant Professor,
Section: C (2nd 30) Dept. of EEE, RUET
Session: 2018-19
1.1 EXPERIMENT NO
01

1.2 EXPERIMENT NAME


Introduction to MATLAB Simulation Tools

1.3 OBJECTIVES
To learn about different blocks in the Simulink
To learn about the MATLAB function in Simulink
To learn about the Hit Cross block in Simulink

1.4 THEORY
1.4.1 HIT CROSS
Hit crossing was used to detect crossing any particular value of the signal. By default, it was
given to detect zero crossing. So, by default it acted as a zero-crossing detector. It can also be
modified to detect any signal level other than zero.

1.4.2 EXERCISE
The problem was given as,
S1 = Sine wave (Vmax = 1 V ; f = 50 Hz)
S2 = Triangular wave (VP-P = 0 to 1 V ; f = 500 Hz)
S3 = Triangular wave (VP-P = -1 to 0 V ; f = 500 Hz)
Now,
Output 1 = 1 ; S1 ≥ S2
0 ; else
Output 2 = 1 ; S1 ≤ S3
0 ; else
Again,
Output final = Output 1 ; S1 > 0
0 ; else
Now, we are to design and simulate the given system in Simulink platform.
1.5 BLOCK DIAGRAM
1.5.1 HIT CROSS

FIGURE 01(a): Block Diagram of Zero Crossing Detector using Hit Cross

FIGURE 01(b): Block Diagram of 0.5 Crossing Detector using Hit Cross
1.5.2 EXERCISE SYSTEM DESIGN

FIGURE 02(a): Block Diagram of the designed system using blocks only
FIGURE 02(b): Block Diagram of designed system using MATLAB Function

CODE

function [x,y,z] = fcn(s1,s2,s3)

if s1 >= s2
x=1
else
x=0
end
if s1 <= s3
y=1
else
y=0
end
if s1 > 0
z=x
else
z=y
end
1.6 OUTPUT
1.6.1 HIT CROSS

FIGURE 03(a): Output of Zero Crossing Detector Using Hit Cross

FIGURE 03(b): Output of 0.5 Crossing Detector Using Hit Cross


1.6.2 EXERCISE PROBLEM

FIGURE 04(a): Output of sine wave generator (S1)


FIGURE 04(b): Output of triangular wave generator (S2)

FIGURE 04(c): Output of triangular wave generator (S3)


FIGURE 04(d): Output 1

FIGURE 04(e): Output 2


FIGURE 04(f): Final output
FIGURE 04(g): Final output using MATLAB Function
1.7 DISCUSSION
The Hit Crossing block was used to detect the crossing any value of voltage which was defined
by the user. Generally, it acted as a zero-crossing detector. After that, it was set to detect when
the sine wave crossed the level 0.5 V.
Then, the given system was designed purely using different block elements. Such as, sine wave
generator, triangular wave generator, constants, relational operators, switch etc. After that, the
same system was designed by the MATLAB Function block.
The outputs were observed by the scopes. Both the designs had nearly same output as expected.
But there was a little bit mismatch between the two due to the sampling time. The system used
by the MATLAB Function block was the accurate one.

1.8 CONCLUSION
To build a practical circuit or, system first of all it’s required to design and simulate the system
in a software for a test run. The Simulink platform had a lot of blocks. With the help of these
blocks nearly all types of circuits or, systems could be designed and simulated in this platform.
So, it’s very convenient to use the Simulink platform for this purpose

You might also like