Simulink
• Simulink is a graphical interface that allows the user to create programs that are actually run in MATLAB. When these programs run, they create arrays of the variables defined in Simulink that can be made available to MATLAB for analysis and/or plotting.
Simulink uses blocks to write a program. Blocks are arranged in various libraries according to their functions. Properties of the blocks and the values can be changed in the associated dialog boxes. Some of the blocks are given below.
SUM (Math library): Represented
Y=x1+x2-x3
GAIN (Math library): represented
INTEGRATOR (Continuous library)
a- implicite initial condB-explicite initial cond
CONSTANTS (Source library)
STEP (Source library)
SIGNAL GENERATOR (Source library)
repetitive signals
2 click:sine, square,ramp etc choose frequency .......
SCOPE (Sinks library)
The system response can be examined graphically
Think of it as an oscilloscope
CLOCK (Sources library) To Workspace (Sinks library)
The To Workspace block is used to return the results of a simulation to the MATLAB workspace, where they can be analyzed and/or plotted. Any variable in a Simulink diagram can be connected to a ToWorkspace block.
Problem1: We need to simulate the resonant circuit and display the current waveform as we change the frequency dynamically.
varies from 0 to 2000 rad/s
10 100 uf
0.01 HV(t)=5sinwt
Observe the current. What do we expect ?
The amplitude of the current waveform will become maximum at resonant frequency, i.e. at = 1000 rad/s
Differentiate wrt time and re-arrange:
LCi
dtid
LR
dtdi
dtdv
L1
2
2
Taking Laplace transform:
LCI
IssILR
LsV 2
LC1
sLR
sIL
sV 2
Constructing the model using Simulink:
‘Drag and drop’ block from the Simulink library window to the untitled window
1
s+1
Transfer Fcn
simout
To WorkspaceSine Wave
Constructing the model using Simulink:
LC1
sLR
s
)L/1(s2 62 101s1000s
)100(s
100s
s +1000s+1e62
Transfer Fcn
v
To Workspace1
i
To WorkspaceSine Wave
TF continous
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1
-0.5
0
0.5
1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-5
0
5
Example in class
100s
s +1000s+1e62
Transfer Fcn
0.802
SliderGain
Scopes
1
Integrator
sin
ElementaryMath
Dot Product2
5
Constant1
2000
Constant
Show the teacher the output on the scope
a. Reproduce the same block diagram using simulink.b. From the simulink blockk diagram fing the transfer function both in time and
frequency domain