Simulink getting started guide: tutorial 1




In this tutorial, a brief and concise introduction of MATLAB and one of many tools of MATLAB i.e. Simulink. This is an introductory tutorial and it will explain very basics of MATLAB as well as Simulink. Some of the basic functions and libraries of Simulink are introduced here, and with the help of very basic details a simple example is performed on Simulink and the results are shown. At the end a simple exercise is provided to do it on your own and in the upcoming tutorials I will expect that you have done that exercise wholeheartedly.




Introduction to MATLAB Simulink

MATLAB is a multi-purpose numerical analysis environment. It is a high performance fourth generation programming language used mostly for technical computing. As mentioned earlier it is a multi-purpose programming environment and is used 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 more a difficult task when you have MATLAB to perform it. Also it is freely available for students on the website of mathworks, for students who are interested in learning a highly diverse programming environment.




Introduction to Simulink

Out of a magnificent number of tools provided by MATLAB, Simulink is one of the widely used and high performance tool. As it is one of the tools of MATLAB it cannot be compared with MATLAB. MATLAB is the father of all. It is provided by MathWorks and it is a graphical programming environment which provides us to simulate, design and execute our desired 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 to provide the input to that summation box, also there is a block of output and oscilloscope to display the output generated by the summation block. This is just a very simple example, however provides us with a wide range of components which I will discuss further after sometime and throughout this session I will be using a number of components so that any ambiguity about this software will be removed.

Getting started with Simulink

  • Let’s first open MATLAB to get started with it and then Simulink. In the search bar of your system write matlab (which was already downloaded and installed in the system) as shown in the figure below,

    Getting started with Simulink

Figure 1: Opening MATLAB

  • It will take some time to open up and after it is open the following window will appear as shown in the figure,Getting started with Simulink

Figure 2: MATLAB starting window

  • After you have opened MATLAB the next step is to open Simulink. You can open it by writing “Simulink” in the command window of MATLAB as shown in the figure below,Getting started with Simulink

Figure 3: Simulink from command window

  • Or also you can open it from the  icon present at the top home panel of MATLAB as shown in the figure below,Getting started with Simulink

Figure 4: icon

  • Opening Simulink will also take quite a lot of time because it is a heavy software. Once Simulink is open it will show a start page as shown in the figure below,Getting started with Simulink

Figure 5:  start page

  • There are also a number of built-in examples present in it.  so that you can run them and learn about the working of different blocks present in Simulink. You can access them from the window at the top of the Simulink starting page as shown in the figure below,Getting started with Simulink

Figure 6: Simulink built in examples

  • These examples can be used as a head start to understand the working of Simulink for a fresher before directly jumping into the programming environment of Simulink and exploring the examples is left as an exercise for the students. Lets’ now create a new project and start working with Simulink. Click on blank project on the start page of Simulink as shown in the figure below,Getting started with Simulink

Figure 7: Creating new project

  • This will create a new blank simple project as shown in the figure below,Getting started with Simulink

Figure 8: Blank project

  • This is an unsaved project and the changes you made to this project will go wasted, Therefore, first of all save the opened 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,Getting started with Simulink

Figure 9: Saving the project

  • Save the project in the directory you wish. The next thing  to be introduced at this stage is the browsing library of simulink. We can access the library browser by clicking on the view button at the top list next to the file and then clicking of library browser as shown in the figure below,Getting started with Simulink

Figure 10: Library browser

  • Or simply you can access library browser by clicking on the library browser icon as shown in the figure below,Getting started with Simulink

Figure 11: Library browser icon

  • The  library browser window will open up after clicking on this icon. This window is shown in the figure below,Getting started with Simulink

Figure 12: Library browser

  • This window contains almost all the blocks one can need to run a program starting from a simple multiplication problem to the working of a motorcycle in a 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 on the blocks as shown in the figure below,Getting started with Simulink

Figure 13: Commonly used blocks

  • At the top bar of simulink also there is present an icon to provide a logic analyzer. As the name suggests it is used to analyze the output of your program of block diagram system. Refer to the figure below to see the location of logic analyzer on simulink window,Getting started with Simulink

Figure 14: Logic analyzer

Making your first block diagram with Simulink

  • Lets’ now do a simple example to understand the working of simulink in a little more depth. We will here perform a simple and operation and run the program. From the commonly used blocks select 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,Getting started with Simulink

Figure 15: Logical operator and Scope

  • From the same library browsers’ 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,Getting started with Simulink

Figure 16: Constant

  • Place all the components as shown in the figure below,Getting started with Simulink

Figure 17: Placed components

  • When you hover over the arrow head of each of the block the pointer will convert to a simple cross and will allow you 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 and run the program from the run button as shown in the figure below,Getting started with Simulink

Figure 18: Running the program

  • After you run 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 oscilloscope, as shown in the figure below,Getting started with Simulink

Figure 19: Output

  • Lets’ know test the program with different input value, i.e. 1 and 0, the output will be (in accordance with the theory) know turns to 0 and simulink shown the similar results as shown in the figure below,Getting started with Simulink

Figure 20: Output

Exercise:

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

Add Comment