# Introduction to Using Simulink in MatLab

4,391

23

1

## Introduction: Introduction to Using Simulink in MatLab

MatLab is a useful tool for writing programs to carry out higher order functions and matrices. Sometime though, sifting through, or writing lines of code can  be overwhelming and tedious. There is a part of MatLab however where you can create a code by using symbols instead of letters and numbers. this part of MatLab is called Simulink. it can make writing certain types of code much faster and easier. it can also be an easier way to code a problem if the user has a limited knowledge of writing codes. This set of instructions will go over the very basics of using Simulink.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Materials/Background Knowledge

Materials required:

A computer

Time Required:

20-30 minutes

Background:

It is not required, but having some knowledge of code writing will be useful.

## Step 2: Open Up MatLab

First you are going to want to open the MatLab program. The Icon can be seen in the first picture.
The second picture shows the main MatLab page when the program is open.

Next you are going to want to look at the top tool bar, you will see a box with four smaller boxes inside with the word Simulink Library under it. Click  on this, it can be seen in the picture.

Have some patients, loading the library can take some time, no more then a couple minutes though.

the second picture shows the Library of all the symbols that can be used to write code using Simulink.

The Next step is to go over to the left set of folders and go down and click on the set called commonly used Blocks.
you will see a set of Blocks as in the picture. these are the most common Blocks that are used when writing simple codes in Simulink. Some are self explanatory, others require more in depth descriptions that I wont go into here.

## Step 5: Creating a New Code

Select any block, in this case I selected the constant Block, right click and select add to new model. this will open a new screen like the one shown in the second picture. The Block you selected will be there. This window is the window where your code will be constructed. From now on, to add new Blocks, they just have to be clicked and dragged into this window.

## Step 6: Basic Math Functions

To add new Blocks, they just have to be clicked and dragged into this window. So far in this model I have three Blocks, the constant Block, the addition Block and the gain Block. the constant block is basically just a number, the addition Block allows you to add, or subtract, two or more other Blocks together. the gain Block is like a multiplier.

## Step 7: Block Parameters

To change the properties of the Blocks, double click on the block and a window like the picture will pop up. This is the properties for the constant Block, here you can change the value of the constant from 1 to say, 5.

## Step 8: Making Formulas

To  connect the Blocks together like in the picture, simply click on the arrows and drag them to the other Block you want to connect it to.

## Step 9: Making a Loop

Using the arrows, you can also  make a Loop, if you want to take the end product of your equation and feed it back into the beginning. This is essential for solving differential equations. As can be seen by the use of the integrator Block in the picture.

## Step 10: Using Scope Block

The scope Block can be used to view a graph of your results, say your using a differential equation like in the previous case or something as simple as the sine function as shown in the picture. simple add the scope Block and drag the arrow to whatever part you want to visualize. Then run your program, and double click on the scope Block and a new window will pop open like the one in the second picture.

## Step 11: Video

Here is a video showing how to open MatLab and then open up Simulink and change the properties of a block.

## Step 12: Conclusion

Now you have a basic understanding of what Simulink can do. The best way to get better is to play around with it and explore the different kinds of Blocks there are and experiment with the different types of codes and equations that you can come up with.

## Recommendations

7 1.5K
44 5.6K
99 7.5K
Table Saw Class

293 Enrolled