You are on page 1of 9

Laboratory 11: Cover Sheet Roll No.

: __________________Name of the Student: ____________________________ Semester: _______________ Course Title: ____________________________________ Laboratory Objectives: 1. To understand how to use simulink Place a check mark in the Assigned column next to the exercises your instructor has assigned to you. Attach this cover sheet to the front of the packet of materials you submit following the laboratory. Activities Pre-lab Exercises In-lab Exercises Take Home Exercises Any Other Remarks Signature

Introduction SIMULINK Windows and Menus To start Simulink, you must first start MATLAB. At the MATLAB prompt, Enter the simulink command. Your desktop includes the MATLAB command window and the

SIMULINK block library window. The SIMULINK block library window displays icons for its block libraries.

You build models by copying blocks from block libraries into a model window. A Model-Building Exercise This example shows you how to build a model using many of the model commands and actions you will use to build your own models.

Comm. System Labs Manual

Page 2

The model generates a Sine wave using a Signal Generator block. To copy the signal generator block and the wave form by passing it through a Gain block. Both the scaled signals are combined into a vector signal using a Mux block. That signal is displayed using a Scope block and sent to a workspace variable. The block diagram of the model looks like this:

In this model, you get blocks from these libraries: Sources library (for the Signal Generator block) Linear library (for the Gain block) Connections library (for the Mux block) Sinks library (for the Scope and the To Workspace blocks)

Create a new model window by selecting New on the File menu.

Comm. System Labs Manual

Page 3

Open the Sources library to copy the Signal Generator block.

The Signal Generator Block

To copy a block from its block library, drag the block into the model window. To do this, position the cursor over the Signal Generator block, then press and hold down the mouse button, see how the cursor shape changes.

Comm. System Labs Manual

Page 4

Now drag the block into the model window (called untitled). As you move the block, you see the outline of the block and its name move with the pointer. When the pointer is in the model window, release the mouse button. A copy of the Signal Generator block is now in your model window.

In the same way, copy the rest of the blocks into the model window. You can move a block from one place in the model window to another using the same dragging technique you use to copy the block. To adjust the number of input ports, open the Mux block by double clicking on it. SIMULINK displays it dialog box. Change the number of inputs parameters value to 2, then click on the OK button. SIMULINK adjusts the number of input ports.

With all the blocks copied into the model window, the model things like this:

Comm. System Labs Manual

Page 5

Now connect the blocks. The > symbol pointing out of a block is an output points to a block, it is an input port. Connect the Signal Generator block to the Mux block. Position of the output port on the right side of the Signal Generator. Press the hold down the mouse button. Notice that the cursor changes to a cross hairs shape. While continuing to hold down the mouse button, move the cursor to the top of the input port of the Mux block or over the Mux block itself. Notice that the cursor keeps its cross hairs shape and that a line connects the Signal Generator block to the top (first available) input port of the Mux block.

Comm. System Labs Manual

Page 6

Now release the mouse button. The blocks are connected. While youre finished connecting the blocks, you need to adjust some of the block parameters. First, open the Gain block and change the Gain Parameter to 2.

Next, open the To Workspace block and change the Variable name parameter to testmtx. This is the name of the workspace variable that will hold the simulation output.

The default output of the Signal Generator block is a Sine wave with an amplitude of 1. Run the simulation for 10 seconds. First, set the simulation parameters by choosing Parameters on the Simulation menu. On the dialog box that appears adjust the Stop Time to 10 and change the Maximum Step Size to 0.1.

Comm. System Labs Manual

Page 7

Now, open the Scope block to view the simulation output. Before run the simulation, adjust the parameters so you can go the properties menu.

The properties window opened, view the entire signal change the Horizontal Range (time) to 10 (seconds) and change the Range .

Keeping the Scope window open, run the simulation. Choose Start on the simulation menu and watch the traces of the Scope blocks vector input.

Comm. System Labs Manual

Page 8

To save the model, choose Save on the File menu and specify the name and location of the M-file that describe the model. To terminate SIMULINK and MATLAB, choose EXIT MATLAB on the file menu.

Comm. System Labs Manual

Page 9

You might also like