Simulink Getting Started Guide: Tutorial 1

In this tutorial, we will look at a brief and concise introduction to MATLAB and one of its tools, known as Simulink. This is an introductory tutorial, and here we will explain the very basics of MATLAB as well as Simulink. Introduction to some of the basic functions and libraries of Simulink, and with the help of explanation, we will perform a simple example and discuss its results. At the end, a simple exercise is provided for you to do on your own. In the upcoming tutorials, we will expect that you have done that exercise.

Introduction to MATLAB

MATLAB is a multi-purpose numerical analysis environment. It is a high-performance fourth-generation programming language that finds its applications in technical computing. It is a multi-purpose programming environment, and we can use it for various problems like developing algorithms, matrix calculation, running algorithms, data visualization, and making an easy-to-use graphical or simple user interface (UI).

Drawing graphs, either 2-dimensional or 3-dimensional, is no longer a difficult task when you have MATLAB to perform it. Also, it is freely available for students on the website of MathWorks for those who have an interest in learning in a highly diverse programming environment.

Out of the magnificent number of tools in MATLAB, Simulink is one of the most widely used and high-performance tools. As it is one of the tools of MATLAB, it cannot be compared with MATLAB. MATLAB is the main application that MathWorks provides, and Simulink is a graphical programming environment that allows us to simulate, design, and execute a program in the form of blocks.

For instance, there is a block of summation present in the libraries of Simulink, and there is a block of a constant as well as input, which can help us provide the input to that summation box. There is also a block of output and an oscilloscope to display the output of the summation block. This is just a very simple example, but it provides us with a wide range of components, which we will discuss further after some time. Throughout this session, we will be using a number of components to remove any ambiguity about this software.

To start with this tutorial, let’s first open MATLAB and then Simulink. In the search bar of the system, type “matlab” (if installation is present on the computer). We will see the icon pop up as shown in the figure below.

Opening the MATLAB
Opening MATLAB

It takes some time to open this program, and after opening, the following window will appear as shown in the figure below.

MATLAB starting window
MATLAB starting window

Now, the next step is to open Simulink. We can open it by writing “Simulink” in the command window of MATLAB, similar to the figure below.

Simulink from command window
Simulink from command window

Another way to open it is by using the icon present at the top of the home panel of MATLAB, as we can see in the following figure.

Simulink's icon
Simulink’s icon

Opening Simulink also takes quite a lot of time because it is heavy software. Once Simulink is open, it will show a start page, as we can see in the following figure.

Start page
Start page

There are also a number of built-in examples in it. So that we can run them and learn about the workings of the different blocks present in Simulink. We can access them from the window at the top of the Simulink starting page. Refer to the figure below.

Simulink's built-in examples
Simulink’s built-in examples

These examples can be used as a head start to understanding the workings of Simulink as a beginner before directly jumping into the programming environment of Simulink. We will leave exploring these examples as an exercise for the students. Now let’s create a new project and start working with Simulink. Click on blank project on the start page of Simulink. Refer to the figure below.

Creating a New project in Simulink
Creating a New Project

This will create a new blank project, as we can see in the following figure.

Blank project of Simulink
Blank project

This is an unsaved project, and the changes we make to it will go to waste. Therefore, first of all, we will save this project so that we can access it sometime later. Click on the file button and then click on “save as“, as shown in the figure below.

Saving the project
Saving the project

Library Browser

After saving the project in the directory of our choice, the next thing we will like to look at is the browsing library of Simulink. We can access the Library Browser by clicking on the VIEW button at the top of the list next to the file and then clicking on the library browser, as shown in the figure below.

Library browser Simulink
Library browser

Another way to access the library browser is by clicking on the library browser icon. Refer to the figure below.

Library browser icon of Simulink
Library browser icon

The library browser window will open up after clicking on this icon. This window is shown in the figure below.

Library browser
Library browser

This window contains almost all the blocks one can need to write a program, starting from a simple multiplication problem to the working of a motorcycle in the robotics section. The most commonly used blocks in Simulink are available in the Commonly Used Blocks subsection. Double-click on the subsection to have a look at the blocks, as shown in the figure below.

Commonly used blocks
Commonly used blocks

On the top bar of Simulink, there is an icon to provide a logic analyzer. As the name suggests, it is used to analyze the output of the block diagram system. Refer to the figure below to see the location of the logic analyzer in the Simulink window.

Logic analyzer of Simulink
Logic analyzer

Let’s do a simple example to understand the workings of Simulink in a little more depth. Here, we will perform a simple AND operation and run the program. From the commonly used blocks, select the AND operator and also a Scope, which will act like an oscilloscope to analyze the output of the operation as shown in the figure below.

Logical operator and scope
Logical operator and scope

From the same library browser block, i.e., commonly used blocks, select a constant and place it at the input of the logical operator as shown in the figure below.

Constant
Constant

Placing Components

Place all the components as shown in the figure below.

Placed components
Placed components

When we hover over the arrow head of each of the blocks, the pointer will convert to a simple cross and allow us to start the connection of the wire. Connect the constants at the input of the logical operator, and at the output of the logical operator, connect the scope. Now run the program using the run button, as shown in the figure below.

Running the Simulink program
Running the program

Simulation

After running the program, double-click on the scope, and a window will appear showing the output of the operator in the form of a wave on the oscilloscope. Refer to the figure below.

Output of Simulink
Output when both inputs are 1

Now we will test the program with different input values, i.e., 1 and 0. The output will change in accordance with the theory. It turns to 0 and shows expected results, as shown in the figure below.

Output of Simulink
Output when one input is 1

Exercise

  • Explore some of the built-in examples of Simulink and try learning the workings of the different blocks used in the featured examples.

Conclusion

In conclusion, this tutorial provides an in-depth overview of how to get started with the MATLAB Simulink Tool. It covers step-by-step procedures along with examples and their explanation to help us better understand the concept. You can utilize this concept to write and develop a program in the MATLAB Simulink tool. At last, we have provided an exercise to reinforce the concept. Hopefully, this tutorial was helpful in expanding your knowledge in regards to Simulink.

You may also like to read:

This concludes today’s article. If you face any issues or difficulties, let us know in the comment section below.

1 thought on “Simulink Getting Started Guide: Tutorial 1”

Leave a Comment