Download LogicalLogicalLogicalLogicalLogical and more Exams Psychological Data in PDF only on Docsity!
Exp.
Getting Start with Simulink Systems in Matlab
Objec tives: To be famili ar with buildi ng comm unication systems using Simulink library, make analysis and numerical or graphical outputs.
Theory: Write a brief explanation about matlab applications.
Procedure :
There are 3 ways to write or draw a simulation system.
- Press New Fig.1 Simulink model untitled M-file Fig. 2
Communication Lab
RunsaveSimulink LibraryStop Fig.2Fig. 1 Main Matlab Window Browser
- Press Simulink library button.
- (^) Window Fig.3 will appear. Press Communication System tools Fig.4 will appear.
- Write commands in Command window in the main Matlab window see Fig.
Example:
Type :
commlib press enter after each command. This opens the communication block set main library Fig.4 and follow the same procedure.
simulink3 press enter, the Simulink library will be shown. Click & Drag a block to the M-file.
Communication Lab
Fig.4 Communication Simulink Library Fig. 3
- In the Simulink Library Browser, select View > Stay on Top to keep the Library Browser on top of the other windows on your desktop.
Browse or Search for Specific Blocks To browse through the block libraries, select a MathWorks ®^ product, and then select a functional
area. Alternatively, you can search all of the available block libraries at once.
- Browse for the block. In the Libraries pane on the left, select Simulink, and then select the Sources library. From the Library displayed in the right pane, select the Sine Wave block.
- Search for a block. In the search box, enter a block name or part of a block name. For
example, enter sine, and then click the Search button.
- Get detailed information about a block. Select the block, and then from the menu bar, select Help > Help for the Selected Block. The Help browser opens with the reference page for that block.
Communication Lab
- View block parameters. Right-click a block, and then select Block Parameters. The block parameters dialog box opens.
Open the Simulink Editor In the Simulink Editor, you can build and simulate models of your system. You need the Simulink Library Browser open before you can create a new Simulink model.
- From the Simulink Library Browser Toolstrip, click the New Model button , or from the menu bar, select File > New > Model. A Simulink Editor window opens with a new block diagram in the right pane.
- Select File > Save as. In the File name text box, enter a name for your model. For example, enter simple_model, and then click Save. Simulink saves your model with the file name simple_model.slx.
Add Blocks to a Model To build a model, begin by copying blocks from the Simulink Library Browser to the Simulink Editor.
- In the Simulink Library Browser, select the Sources library. The Library Browser displays blocks from the selected library in the right pane.
- Select the Sine Wave block, and then drag the block to the block diagram.
A copy of the Sine Wave block appears in your model.
- Add the following blocks to your model, using the same approach that you used to add the Sine Wave block. Library Block Sinks Scope Continuous Integrator Signal Routing Bus Creator
- Your model now has the blocks you need for the simple model.
Communication Lab
Draw Signal Lines Between Blocks Connect the blocks by drawing lines between output ports and input ports.
- Position the cursor over the output port on the right side of the Sine Wave block. The pointer changes to a cross hair (+) while over the port.
- Click, and then drag a line from the output port to the top input port of the Bus block. While you are holding down the mouse button, the connecting line appears as a red dotted arrow.
- Release the mouse button when the pointer is over the output port. Simulink connects the blocks with a line and an arrow indicating the direction of signal flow.
- Connect the output port of the Integrator block to the bottom input port on the Bus block using this alternative procedure: 4.1. Select the Integrator block. 4.2. Press and hold the Ctrl key. 4.3. Click the Bus block. The Integrator block connects to the Bus block with a signal line. Note: The Ctrl+click shortcut is useful when you are connecting widely separated blocks or
Communication Lab
when working with complex models.
- Connect the Bus block output port to the Scope block.
Draw Branched Signal Lines Your simple model is almost complete. To finish the model, connect the Sine Wave block to the Integrator block.
This connection is different from the other connections, which all connect output ports to input ports. Because the output port of the Sine Wave block is already connected, you must connect this existing line to the input port of the Integrator block. The new line, called a branch line , carries the same signal that passes from the Sine Wave block to the Bus block.
- Hold down the Ctrl key.
- Position the cursor where you want to start a branch line. Click, and then drag the cursor away from the line to form a dotted-red line segment.
- Drag the cursor to the Integrator input port, and then release the mouse button.
- Drag line segments to straighten and align with blocks. Your model is now complete.
Communication Lab
The Scope window opens and displays the simulation results. The plot shows a sine wave signal with the resulting cosine wave signal from the Integrator block.
- From the Scope block toolbar, click the Parameters button. Select the Style tab. The Scope Parameters dialog box displays figure editing options.
- Change the appearance of the figure. For example, select white for the Figure color and Axes background color (icons with a pitcher) and black for the Ticks, labels and grid colors (icon with a paintbrush). Change the signal line colors for signal 1 to blue and for signal 2 to green. To see your changes, click OK.
Communication Lab
- Select File > Close > Close Model. The Simulink Editor closes with changes to your model and the model configuration parameters.
Communication Lab