0% found this document useful (0 votes)
29 views15 pages

Exp 02

This document describes an experiment using MATLAB and Simulink to simulate various electrical and electronic circuits. The objectives are to learn how to use the MATLAB Function block, Mean block, PLL block, Sample & Hold block, and PWM Generator block. Circuits for a half-wave rectifier, full-wave rectifier, and sample-and-hold are designed and analyzed. Pulse signals are generated manually and with a PWM block. The document includes block diagrams, MATLAB code, output waveforms, and a discussion of the results.

Uploaded by

Mehedi Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views15 pages

Exp 02

This document describes an experiment using MATLAB and Simulink to simulate various electrical and electronic circuits. The objectives are to learn how to use the MATLAB Function block, Mean block, PLL block, Sample & Hold block, and PWM Generator block. Circuits for a half-wave rectifier, full-wave rectifier, and sample-and-hold are designed and analyzed. Pulse signals are generated manually and with a PWM block. The document includes block diagrams, MATLAB code, output waveforms, and a discussion of the results.

Uploaded by

Mehedi Hasan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

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.: 02

Experiment Name: Introduction to Advanced MATLAB Simulation Tools


Date of Experiment: 12 October, 2022
Date of Submission: 19 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
2.1 EXPERIMENT NO
02

2.2 EXPERIMENT NAME


Introduction to Advanced MATLAB Simulation Tools

2.3 OBJECTIVES
To learn about the MATLAB Function block in Simulink
To learn about the Mean block in Simulink
To learn about the PLL block in Simulink
To learn about the Sample & Hold block in Simulink
To learn about the PWM Generator block in Simulink
To learn how to design half wave & full wave rectifier circuits using diodes
To learn how to generate pulse signal of different width manually

2.4 THEORY
2.4.1 EXERCISE PROBLEM
We were to design a system using MATLAB Function,
S = Sine wave (Vmax = 1 V ; f = 50 Hz)
S1 = | S |
S2 = Triangular wave (VP-P = 0 to 1 V ; f = 500 Hz)
Now,
Y1 = 1 ; S1 ≥ 0.5
0 ; else
Y2 = 1 ; S2 > S1
0 ; else

2.4.2 MATLAB FUNCTION


It is a block where different types of codes could be written. The output of this block depends
on the coding. This block might have multiple inputs and multiple outputs. This is very useful
and reduces the used block in a system simulation.
Fig 1(a): MATLAB Function Block

2.4.3 MEAN
This block was used to find the average value of any signal. The frequency of the signal must
be given to the mean block beforehand. If any signal had multiple frequency then the
fundamental frequency should be given.

Fig 1(b): Mean block


2.4.4 PLL
The PLL block was used to measure the phase & frequency of any signal. Here also the
fundamental frequency was given.

Fig 1(c): PLL Block


2.4.5 SAMPLE & HOLD
In the sample and hold circuit, the output followed the input as long as reference signal was
high. When the reference signal became low the output was at hold to the last input signal. It
was held until the reference became high again.

Fig 1(d): Sample & Hold Block


2.4.6 PWM GENERATOR
It was used to generate pulse signal of different width by giving the duty cycle as the input.

Fig 1(e): PWM Generator Block


2.4.7 MANUAL PULSE GENERATION
Pulse signal was generated with the help of a sawtooth generator and a constant signal as the
duty cycle. It was implemented by purely block diagrams only and also by using MATLAB
Function.
2.4.8 HALF WAVE & FULL WAVE RECTIFIER
We were to design half wave and full wave rectifier circuits using diodes. There were many
types of diode block in Simulink library. The block used here was found in Simscape »
Electrical » Specialized Power Systems » Fundamental Blocks » Power Electronics. After
designing the systems the mean values was also measured.

2.5 BLOCK DIAGRAM


2.5.1 EXERCISE PROBLEM

FIGURE 02(a): Block Diagram of the exercise problem

MATLAB FUNCTION CODE


function [s1,s2,y1,y2] = fcn(s,t)

s1=abs(s);
s2=(t+1)/2;
if s1 >= 0.5
y1=1
else
y1=0
end
if s2 > s1
y2=1
else
y2=0
end
2.5.2 HALF WAVE RECTIFIER

FIGURE 02(b): Block Diagram of Half wave rectifier circuit

2.5.3 FULL WAVE RECTIFIER

FIGURE 02(c): Block Diagram of Full wave rectifier circuit

2.5.4 DC VALUE OF HALF WAVE RECTIFIER

FIGURE 02(d): Measuring the DC value of Half wave rectifier


2.5.5 DC VALUE OF FULL WAVE RECTIFIER

FIGURE 02(e): Measuring the DC value of Full wave rectifier

2.5.6 SAMPLE & HOLD CIRCUIT

FIGURE 02(f): Block Diagram of Sample & Hold circuit

2.5.7 MEASUREMENT OF PHASE & FREQUENCY

FIGURE 02(g): Measurement of phase & frequency


2.5.8 PULSE GENERATION (A)

FIGURE 02(h): Manual pulse generation using blocks

2.5.9 PULSE GENERATION (B)

FIGURE 02(i): Manual pulse generation using MATLAB Function

MATLAB CODE

function y1 = fcn(s,c)

s=(s+1)/2;
if c > s
y1=0
else
y1=1
end
2.5.10 PULSE GENERATION (C)

FIGURE 02(j): Pulse generation using PWM Generator

2.6 OUTPUT
2.6.1 EXERCISE PROBLEM

FIGURE 03(a): Output of exercise problem


2.6.2 HALF WAVE RECTIFIER

FIGURE 03(b): Output of Half wave Rectifier Circuit

2.6.3 FULL WAVE RECTIFIER

FIGURE 03(c): Output of Full wave Rectifier Circuit


2.6.4 DC VALUE OF HALF WAVE RECTIFIER

FIGURE 03(d): DC value of half wave rectifier


2.6.5 DC VALUE OF FULL WAVE RECTIFIER

FIGURE 03(e): DC value of Full Wave rectifier


2.6.6 SAMPLE & HOLD CIRCUIT

FIGURE 03(f): Output of Sample and Hold Circuit


2.6.7 MEASUREMENT OF PHASE & FREQUENCY

FIGURE 03(g): Measurement of Phase and Frequency


2.6.8 PULSE GENERATION (A)

FIGURE 03(h): Manual pulse generation by Blocks

2.6.9 PULSE GENERATION (B)

FIGURE 04(i): Manual pulse generation by MATLAB Function


2.6.10 PULSE GENERATION (C)

FIGURE 03(j): Pulse Generation by PWM Generator

2.7 DISCUSSION
The exercise problem was solved by the MATLAB Function. There were multiple inputs and
multiple outputs used in MATLAB Function.
The half wave and full wave rectifier circuits were designed by diodes. The diodes must be
taken specifically form a single directory of the Simulink library. Otherwise, the terminals
would not be connected. Then the output waveforms were shown and also the average values
of the output signals were measured by the Mean block.
The ‘sample and hold circuit’ was designed by the sample and hold block.
The phase and frequency of a signal were measured by the help of the PLL block.
Then pulse signals were created manually with the help of sawtooth generator and a constant
signal as the duty cycle (60%). It was implemented by Blocks and also by MATLAB
Function(duty cycle 50%).
After that PWM Generator was used to make the pulse signal directly (duty cycle 70%).

2.8 CONCLUSION
As the Simulink library was huge. So, it was very much efficient to perform different circuit
analysis.

You might also like