2 What Is Simulink? Simulink is a software package for modeling, simulating, and analyzing dynamical systems. It supports linear and nonlinear systems, modeled in continuous time, sampled time, or a hybrid of the two.
3 How to open simulink Click on this item
4 create a model To create the model, first type simulink in the MATLAB command window. On Microsoft Windows, the Simulink Library Browser appears.
6 Open new window Simulink opens a new model window. Click on New Model button
7 Model Editor
8 View Command History Back =(Displays the previous view in the view history.Forward ) forward=( Displays the next view in the view history.Go To Parent ) Go To Parent=Opens, if necessary, the parent of the current subsystem and brings its window to the top of the desktop.
9 Building a Simple Model This example shows you how to build a model using many of the model building commands and actions you will use to build your own models The model integrates a sine wave and displays the result, along with the sine wave. The block diagram of the model looks like this
10 Create example model To create this model, you will need to copy blocks into the model from the following Simulink block libraries: 1.Sources library (the Sine Wave block) 2.Sinks library (the Scope block) 3.Continuous library (the Integrator block) 4.Signals & Systems library (the Mux block)
11 first expand the Library Browser tree to display the blocks in the Sources library. Do this by clicking first on the Simulink node to display the Sources node Sources node to display the Sources library blocks. Finally right click on the Sine Wave node to select the Sine Wave
12 Copy the rest of the blocks in a similar manner from their respective libraries into the model window
13 With all the blocks copied into the model window, the model should looksomething like this. Now its time to connect the blocks. Hold down the mouse button and move the cursor to the top input port of the Mux block. Notice that the line is dashed while the mouse button is down and that the cursor shape changes to double-lined cross hairs as it approaches the Mux block.
14 Now release the mouse button. The blocks are connected Press and hold down the Ctrl key. Press the mouse button, then drag the pointer to the Integrator blocks input port or over the Integrator block itself.
15 Finish making block connections. When youre done, your model should look something like this.
17 Now, open the Scope block to view the simulation output. Keeping the Scope window open, set up Simulink to run the simulation for 10 seconds. the simulation parameters by choosing Parameters from the Simulation menu. On the dialog box that appears notice that the Stop time is set to 10.0 (its default value)
Simulation > Configuration Parameters
Sine Wave block Double click
20 Choose Start from the Simulation menu and watch the traces of the Scope blocks input.
21 Model Viewing Shortcuts
22 Zooming Block Diagrams Select Zoom In from the View menu (or type r) to enlarge the view.Select Zoom Out from the View menu (or type v) to shrink the view. Select Fit System To View from the View menu (or press the space bar) to fit the diagram to the view. Select Normal from the View menu (or type 1) to view the diagram at actual size.
23 colors Simulink allows you to specify the foreground and background colors of any block select Screen color from the Simulink Format menu
24 Connecting Blocks Connecting Two Blocks To auto connect two blocks: Select the source block. Hold down Ctrl and left-click the destination block.Simulink connects the source block to the destination block
25 Connecting Groups of Source Blocks Simulink can connect a group of source blocks to a destination block or a source block to a group of destination blocks.To connect a group of source blocks to a destination block: Select the source blocks. Hold down Ctrl and left-click the destination block.
26 connect a source block to a group of destination blocks Select the destination blocks. Hold down Ctrl and left-click the source block.
27 Moving a Line Segment To move a line segment: Position the pointer on the segment you want to move. Press and hold down the left mouse button. Drag the pointer to the desired location.
28 Inserting Blocks in a Line To insert a block in a line: Position the pointer over the block and press the left mouse button. Drag the block over the line in which you want to insert the block. Release the mouse button to drop the block on the line. Simulink inserts the block where you dropped it.
29 Disconnecting Blocks To disconnect a block from its connecting lines, hold down the Shift key, then drag the block to a new location.
30 Creating Subsystems As your model increases in size and complexity, you can simplify it by grouping blocks into subsystems. Using subsystems has these advantages: It helps reduce the number of blocks displayed in your model window. It allows you to keep functionally related blocks together
31 Creating a Subsystem by Adding the Subsystem Block To create a subsystem before adding the blocks Copy the Subsystem block from the Ports & Subsystems library into your model. Open the Subsystem block by double-clicking it. In the empty Subsystem window, create the subsystem. For example, the subsystem shown includes a Sum block and inport and Outport blocks to represent input to and output from the subsystem.
32 Creating a Subsystem by Grouping Existing Blocks If your model already contains the blocks you want to convert to a subsystem, you can create the subsystem by grouping those blocks: Enclose the blocks and connecting lines that you want to include in the subsystem within a bounding box. You cannot specify the blocks to be grouped by selecting them individually or by using the Select All command. Choose Create Subsystem from the Edit menu. If you open the Subsystem block, Simulink displays the underlying system, as shown below.