Type simulink in the MATLAB Command window to start Simulink. The Simulink window opens. See Figure 9.2-1. The Simulink blocks LIBRARY are located in “libraries.” These libraries are displayed under the Simulink heading BROWSER in Figure 9.2-1. Depending on what other Mathworks products are installed, you might see additional items in this window, such as the Control System Toolbox and Stateflow. These provide additional Simulink blocks, which can be displayed by clicking on the plus sign to the left of the item. As Simulink evolves through new versions, some libraries are renamed and some blocks are moved to different libraries, so the library we specify here might change in later releases. The best way to locate a block, given its name, is to type its name in the Find pane at the top of the Simulink Library Browser. When you press Enter, Simulink will take you to the block location and will display a brief description of the block in the pane below the Find pane. To create a new model, click on the icon that resembles a clean sheet of paper, or select New from the File menu in the Browser. A new Untitled window opens for you to create the model. To select a block from the Library Browser, double-click on the appropriate library and a list of blocks within that library then

The Simulink Library Browser.

The Simulink Library Browser.

appears as shown in Figure 9.2-1. This figure shows the result of double-clicking on the Continuous library, then clicking on the Integrator block. Click on the block name or icon, hold the mouse button down, drag the block to the new model window, and release the button. Note that when you click on the block name in the Library Browser, a brief descriptionof the block’s function appears at the top of the Browser. You can access help for that ‘block by rightclicking on its name o~icon, and selecting Help from the drop-down menu Simulink model files have the extension . rndl. Use .the File menu in the model window to Open, Close, and Save model files. To print the block diagram of the model, select Print on the File menu. Use the Edit menu to copy, cut and paste blocks. You can also use the mouse for these operations. For example, to delete a block, click on it and press the Delete key.

Getting started with Simulink is best done through examples, which we now present you can select the ODE solver to use by clicking on the Solver tab. The default is ode45. To have Simulink automatically connect two blocks, select the  ource block, hold down the Ctrl key, and left-click on the destination block. Simulink also provides easy ways to connect multiple blocks and lines; see the help for information.

Note that blocks have a Block Parameters window that opens when you double-click on the block. This window contains several items, the number and nature of which depend on the specific type of block. In general, you can use the default values of these parameters, except where we have explicitly indicated that they should be changed. You can always click on Help within the Block Parameters window to obtain more information.

When you click on Apply, any changes immediately take effect and the window remains open. If you click on OK, the changes take effect but the window closes. Note that most blocks have default labels. You can edit text associated with a block by clicking on the text and making the changes. You can save the Simulink model as an M- file by selecting Save from the File menu in Simulink. The model file can then be reloaded at a later time. You can also print the diagram b. selecting Print on the File menu.

The Scope block is useful for examining the solution, but if you want to obtain a labeled and printed plot you can use the To Workspace block, which i described in the next example.

Simulink can beconfigured to put the time variable tout into the MATLAB workspace automatically when you are using the To Workspace block. This is done with the Data 110tab under Configuration Parameters on the Simulation menu. The alternative is to use the Clock block to put tau t into the workspace.

The Clock block has one parameter, Decimation. If this parameter is set to I, the Clock block will output the time every time step; if set to 10 for example, the block will output every lO time steps, and so on

Share This