0% found this document useful (0 votes)
35 views5 pages

SIMULINK Basics: Step-by-Step Guide

1. The document describes how to set up and use Simulink in MATLAB to model and simulate dynamic systems. It provides examples of modeling an RL circuit, RLC circuit, and the Van der Pol equation. 2. Key steps include opening Simulink, building models with blocks, setting simulation parameters, and viewing/analyzing results. Models are created by selecting blocks from libraries and connecting them to represent the system equations. 3. Examples demonstrate modeling first order and second order systems, integrating blocks to represent derivatives, and using scopes and workspace blocks to view output signals over time. Tasks analyze and verify the simulation results.

Uploaded by

Abhay Jangir
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)
35 views5 pages

SIMULINK Basics: Step-by-Step Guide

1. The document describes how to set up and use Simulink in MATLAB to model and simulate dynamic systems. It provides examples of modeling an RL circuit, RLC circuit, and the Van der Pol equation. 2. Key steps include opening Simulink, building models with blocks, setting simulation parameters, and viewing/analyzing results. Models are created by selecting blocks from libraries and connecting them to represent the system equations. 3. Examples demonstrate modeling first order and second order systems, integrating blocks to represent derivatives, and using scopes and workspace blocks to view output signals over time. Tasks analyze and verify the simulation results.

Uploaded by

Abhay Jangir
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

SIMULINK basics

1. First few steps:

(a) Perform a single left-mouse click on the Home folder listed on the Desktop.
(b) Create a folder in your name, say xyz_PS in /home/eeuser/.
(c) Give a single left-mouse click on the folder just created.
(d) Press F4 to open a Terminal in the path /home/eeuser/xyz_PS.
(e) Type matlab against the $-prompt in the Terminal and press the Enter key.
This opens the MATLAB Command Window.
(f) Ensure that you are in the correct path by typing pwd.
(g) You can list all the files in the current path by typing ls.

2. Loading the SIMULINK editor:

(a) Type simulink in the MATLAB Command Window against the >> prompt
and press the Enter key. This open a window titled Library: Simulink.
(b) Select File → New → Model. This opens an editor for building the analog-
type model for a state-space representation of a system.
(c) From the Library: Simulink window, right-click on any block library and
choose Open Block from the menu to open a set of task blocks.
(d) From this set, using the left-click-drag and drop feature, make a copy of the
desired blocks to the model file and then interconnect them so as to realize the
state-space model.
(e) Save the model file as [Link] in the current path.

NOTE:

• One may use right-click-drag and drop feature to make a copy of the already
existing block in the editor.
• Interconnection between blocks is done by using the left-click-drag feature.
• Tapping of signals from an existing connection is performed by using right-
click-drag facility.

3. Example-1: RL- series circuit excited by a unit-step


Consider an RL- series circuit excited by a unit-step voltage as shown in Figure 1.
The state-space equation for the inductor current with iL (0) = 0 is given by

diL R v
= − iL +
dt L L

NITK Surathkal 1 Electrical Dept.


SIMULINK basics

iL
R

v L

Figure 1: RL -series circuit.

The above state-model is realized in SIMULINK as shown in Figure 2.

Figure 2: RL -series circuit block diagram with Step- and Gain-block details.

The simulation parameters are set by selecting Simulation → Configuration


Parameters in the model file. As in Figure 3, Fixed-step method is chosen with
ode1 (Euler) and step-size =h.
To run the simulation perform the following:

(a) Initialize R = 1 Ω and L = 0.1 H in the Command Window.


(b) Initialize h = 0.001 s.
(c) Select Simulation → Start to run the simulation.
(d) Give a double-click on the Integrator block and ensure that the field Initial
Condition is set zero to satisfy iL (0) = 0.

NITK Surathkal 2 Electrical Dept.


SIMULINK basics

Figure 3: Setting the simulation parameters.

Task list:

(a) Verify the resulting plot for iL by checking the approximate raise time or by
comparing it wrt the discrete-samples obtained from the analytical expression.
(b) Now set only h to say 0.01, 0.1, 0.2 and 0.21 s separately and re-run the
simulation. Indicate your inferences.
(c) Initialize R=[1, 0.2, 0.5], L=[0.1, 0.2, 0.25] and h=0.001 s in the Command
Window and re-run the simulation.

4. Example-2: RLC- series circuit excited by a unit-step


Consider an RLC- series circuit excited by a unit-step voltage as shown in Figure 4.
i
L
R1 L

C
i R2 vc
v 1 i
L
I II

Figure 4: RLC -series circuit.

The state-space equation for the circuit with iL (0) = 0 and vc (0) = 0 is given by

diL R1 R2 vc R2
= −iL − +v
dt L (R1 + R2 ) L L (R1 + R2 )
dvc iL
=
dt C

NITK Surathkal 3 Electrical Dept.


SIMULINK basics

The above state-model is realized in SIMULINK as shown in Figure 5.

Figure 5: RLC -series circuit block diagram with ‘To Workspace’ blocks.

To run the simulation perform the following:

(a) Initialize R1 = 1 Ω, R2 = 0.5 Ω, L = 0.5 H and C = 1 F in the Command


Window.
(b) Select Simulation → Configuration Parameters and set Fixed-step method
with ode4 (Runge-Kutta) and Fixed-step size = 0.001 s.
(c) In the ‘To Workspace’ block, set the Variable name as Vc and the Save format
as Array. A similar setting is made for ‘To Workspace1’ wrt the variable name
time.
(d) Save the model file and select Simulation → Start to run the simulation.

Task list:

(a) Verify the resulting plot for iL and vc by comparing them wrt the discrete-
samples obtained from the analytical expressions.
(b) Check the availability of variables Vc and time in the Command Window and
issue a plot command to display vc (t) waveform.
(c) Determine the natural frequency and the decrement factor from the waveform.

5. Example-3:Van der Pol Equation


The Van der Pol equation is given by

ÿ + (y 2 − 1)ẏ + y = 0

The above equation can be rewritten as

ÿ = −(y 2 − 1)ẏ − y

NITK Surathkal 4 Electrical Dept.


SIMULINK basics

Choosing the state variables as

x1 = y and
x2 = ẏ

we get the state-space equation as given by

x˙1 = x2
x˙2 = −(x21 − 1)x2 − x1

With x1 (0) = 1 and x2 (0) = 1 the above state-model is realized in SIMULINK as


shown in Figure 6.

Figure 6: State-model for the Van der Pol equation with XY-Graph block.

NITK Surathkal 5 Electrical Dept.

You might also like