MATLAB Simulink: (For Old Versions of MATLAB)
MATLAB Simulink: (For Old Versions of MATLAB)
MATLAB Simulink: (For Old Versions of MATLAB)
MATLAB Simulink
MATLAB is a high-performance language for technical computing. It integrates computation,
visualization, and programming in an easy-to-use environment where problems and solutions are
expressed in familiar mathematical notation. Typical uses include:
The name MATLAB stands for Matrix Laboratory. MATLAB was originally written to provide
easy access to matrix software developed by the LINPACK and EISPACK projects, which
together represent the state-of-the-art in software for matrix computation. [1]
In Power electronics lab, we are concern with simulation of different power conversion circuits,
let’s discuss about environment in MATLAB where we can easily simulate any circuit named
Simulink.
➢ For simulations of Power Electronics in MATLAB Simulink, the library path is:
MATLAB→ Simulink→ Simscape→ SimPowerSystems→ Power Electronics.
(For old versions of MATLAB)
Simulink is a block diagram environment for multi-domain simulation and Model-Based Design.
It supports system-level design, simulation, automatic code generation, and continuous test and
verification of embedded systems. Simulink provides a graphical editor, customizable block
libraries, and solvers for modeling and simulating dynamic systems. It is integrated with
MATLAB, enabling you to incorporate MATLAB algorithms into models and export simulation
results to MATLAB for further analysis.
P a g e 1 | 12
MATLAB Simulink Tutorial For Power Electronics
KEY FEATURES:
➢ Model analysis tools for refining model architecture and increasing simulation speed.
➢ MATLAB Function block for importing MATLAB algorithms into models.
➢ Legacy Code Tool for importing C and C++ code into models. [2]
SIMSCAPE:
Simscape is one of the tool box in Simulink’s library. Simscape contains the tools
which are required for simulation of physical systems. Simscape includes blocks from the electrical
domain, as well as other physical domains (mechanical, hydraulic, pneumatic, thermal etc).
SIMPOWERSYSTEMS:
SimPowerSystems has some single-phase components as well. You do get some overlap between
SimPowerSystems and Simscape/SimElectronics for basic components, such as resistor, capacitor,
inductor, etc. SimPowerSystems is really aimed at power generation, power distribution and power
transmission, looking at things like power quality. Simscape and SimElectronics are more
designed for modelling electro-mechanical systems, analog electronics, semi-conductors, etc.
BLOCK LIBRARIES:
For detail study of all block libraries in Simulink, check the official link of
Mathworks for help given below.
https://www.mathworks.com/help/simulink/referencelist.html?type=block
P a g e 2 | 12
MATLAB Simulink Tutorial For Power Electronics
STEP 2: With MATLAB running, there are different ways to start Simulink.
i. Type ‘Simulink’ at the MATLAB prompt (Command Window) and press the Enter key.
ii. Go to Home→ Click on the ‘New’ icon→ Select the new Simulink model.
iii. Go to Home→ Click on the ‘Simulink Library’.
P a g e 3 | 12
MATLAB Simulink Tutorial For Power Electronics
➢ To open new model, click on New Model Template or File→ New→ Model (Cntrl+N).
➢ To save your model, file menu (Untitled)→ Save as→ Enter a name for your model (In the
File name text box)→ Click Save. The model is saved with the file extension.slx.
➢ To browse through the block libraries, select a MathWorks product and then a functional
area in the left pane. To search all of the available block libraries, enter a search term.
➢ Get detailed information about a block. Right-click a block, and then select Help for the
<block name>. The Help browser opens with the reference page for the block.
➢ View block parameters. Right-click a block, and then select Block Parameters. The block
parameters dialog box opens.
➢ Access the Simscape Electrical Block Libraries in both old and new version of MATLAB
shown in figures below.
P a g e 6 | 12
MATLAB Simulink Tutorial For Power Electronics
STEP 4: Now Add blocks to model. You build models by dragging blocks from the Simulink
Library Browser window to the Simulink Editor or single-clicking your model and entering a
search term.
To build the simple model, begin by copying blocks from the Simulink Library Browser to the
Simulink Editor.
Note that you need the ‘POWERGUI’ Block to simulate any Simulink model containing
Simscape Electrical Specialized Power Systems blocks. It stores the equivalent Simulink circuit
that represents the state-space equations of the model. When using one Powergui block in a model:
➢ Place the Powergui block in the top-level diagram for optimal performance.
➢ Make sure that the block uses the name Powergui.
P a g e 7 | 12
MATLAB Simulink Tutorial For Power Electronics
STEP 5: Running a simulation once model completed. Running a Simulink model is a two-step
process. First Simulation parameters such as the solver used to solve the model; the start and stop
time for the simulation; the maximum step size etc. are specified. Then the simulation is started.
The simulation can be paused or stopped while it running.
Make sure that the model window is the active window before starting a simulation. Simulink
starts the simulation at the start time specified and continues till the simulation reaches the final
time step specified in the solver option. Completion of simulation will be indicated by a beeping
sound. Progress of the simulation is shown at the bottom of the model window.
P a g e 8 | 12
MATLAB Simulink Tutorial For Power Electronics
STEP 6: Viewing output to observe simulation result. To view the output of the model, double
click on ‘Scope’ block. If you not set the “Scope Parameter” of scope then click on the auto-scale
icon to view the output response.
EXAMPLE:
To build the simple model, begin by copying blocks from the Simulink Library
Browser to the Simulink Editor.
➢ In the left pane of Simulink Library Browser, select the Sources library.
➢ From the right pane, select the Sine Wave block.
➢ Drag the Sine Wave block to the Simulink Editor. A copy of the Sine Wave block appears
in your model with a text box for entering the value of the Amplitude parameter. In the text
box enter 2.
P a g e 10 | 12
MATLAB Simulink Tutorial For Power Electronics
➢ Before you connect the blocks in your model, arrange the block inputs and outputs to make
signal connections as straightforward as possible.
➢ After you define the configuration parameters, you are ready to simulate your model.
➢ After simulating a model, you can view the simulation results in a Scope window.
That’s all enough for an introduction to MATLAB Simulink. Now you can simulate any circuit
easily using Simulink.
P a g e 12 | 12