Getting Started with Simulink | Simulink Tutorial

MATLAB Helper Quiz

What is Simulink

Simulink is a simulation and model-based design environment for dynamic and embedded systems. Simulink is a data flow graphical programming language tool for modeling, simulating, analyzing multi-domain dynamic systems. It is basically a graphical block diagramming tool with a customizable set of block libraries.

It is a drag and drop system for simulation components that can then be connected between them with lines. The components you use can be configured and you have components that allow for mathematical operations. It allows you to incorporate MATLAB algorithms into a model as well as export the simulation results into MATLAB for further analysis.

It is a great way to model your system, as it is very visual and is suited for some applications that are not too specific, or performant.

 

Terminology used in Simulink:

Block:     They generate, modify, combine, output, and display signals. There are several classes of blocks: Sources, Sinks, Continuous, Discrete, Math operators etc.

Lines:     It transfer signals from one block to another.

Model:     In Simulink, a model is a collection of blocks which, in general, represents a system.

Simulink block Library:     A Block library is a collection of blocks that you can use to create instances of those blocks in a Simulink model. You can create instances of blocks from installed Simulink libraries and you can create custom libraries to create and maintain instances of your own blocks in the model.

 

How to open Simulink?

  1. Selecting Simulink model from the New option in the File menu or by hitting ctrl+N in any Simulink window, creates a new Simulink model.
  2. You can use following commands to open a Simulink model:
  • new_system [name of the model]     -To create new empty model window
  • open_system [name]     -open existing model or block.
  • load_system      – Load existing model without making model visible.
  • save_system      – Save an open model.
  • close_system     – close open model.
  1. You can open the Simulink library from the menu or type the command ‘simulink’ in the command window and select new from the file menu of library browser.

 

How to create a model in Simulink?

Here we will see how to create a new model and simulate it with a simple example.

Example: To see unit step response of a given transfer function.

[Transfer function: The transfer function of a system is the relationship of the system’s output to its input, represented in the complex Laplace domain. If the complex Laplace variable is s, then we generally denote the transfer function as either G(s) or H(s).

Step response:  The response of a system (with all initial conditions equal to zero at t=0, i.e. a zero state response) to a unit step input is called the unit step response.]

The model consists of three blocks: Step, transfer function, and scope. Step is the source block here, the transfer function is continuous block and scope is sink block. Lines transfer the signals.

 

Step 1.  Opening New Simulink model.

Go to: MATLAB home >> New >> Simulink model.

 

Step 2: Inserting Blocks

Drag and drop blocks called Transfer Function, Step and scope by simply searching then the Library browser.

Connect the blocks with Help of lines directing the aero in the block.

 

Step 3. Modifying Blocks

Double click the Block to change its parameters.

For example, if you double-click the block Transfer Fcn, you will see this dialog box.

The dialog box contains fields for numerator and denominator of the transfer function. Enter desired values of coefficients in vector form. For example to write a first order transfer function (1+s) type  [1 1] and to write second order transfer function (s2 +2s + 4) in denominator, write [1 2 4] in denominator coefficient field. After modification, close the window.

Open step block window. By default, it generates a step function occurring at time = 1 sec., from an initial value of zero to level of one.

 

Step 4: Running simulations

To run simulation press ctrl+T or press the Run button  in the model.

 

Results:

For first order Transfer function:

 

For second order Transfer function:

Tip:  To get Help in Simulink type the command ‘help Simulink’ or simply go to the help menu in your Simulink model.

Leave a Comment


She completed her graduation in Electronics and Telecommunication from MIT Academy of Engineering, Pune. She has recently associated herself with MATLAB Helper and enjoys providing help in MATLAB and Simulink. She has a keen interest in astronomy and always finds time to keep that part of her alive.