Exp 02
Exp 02
Rajshahi University of
Engineering & Technology
Experiment No.: 02
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.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.
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
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)
2.6 OUTPUT
2.6.1 EXERCISE PROBLEM
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.