Experiment 004 - Its about how to solve equations on the matlab PDF

Title Experiment 004 - Its about how to solve equations on the matlab
Author Shahbaz Arain
Course Signals and systems
Institution Bahauddin Zakariya University
Pages 16
File Size 926.1 KB
File Type PDF
Total Downloads 99
Total Views 121

Summary

Its about how to solve equations on the matlab...


Description

Experiment 4 Generating Signals using Simulink Exercise Objective: To generate signals using MATLAB simulink.

Requirement: 

Intel based computer



MATLAB

Theory: Simulink is a software package that enables you to model, simulate, and analyze system whose outputs change over time. Such systems are often referred to as dynamic systems. Simulink can be used to explore the behavior of a wide range of real-world dynamic systems, including electrical circuits, shock absorbers, braking systems, and many other electrical, mechanical, and thermodynamic systems

Procedure: Starting simulink: To start Simulink, you must first start MATLAB. Consult your MATLAB documentation for more information. You can then start Simulink in two ways: Click the Simulink icon on the MATLAB toolbar. Enter the simulink command at the MATLAB prompt. On Microsoft Windows platforms, starting Simulink displays the Simulink Library Browser.

Figure 5.1: The Simulink library browser Using the simulink toolbar to enter commands: Model windows in the Windows version of Simulink optionally display a toolbar beneath the Simulink menu bar. To display the toolbar, select the Toolbar option on the Simulink View menu.

The toolbar contains buttons corresponding to frequently used Simulink commands, such as those for opening, running, and closing models. You can run such commands by clicking the corresponding button. For example, to open a Simulink model, click the button containing the open folder icon. You can determine which command a button executes by moving the mouse pointer over the button. A small window appears containing text that describes the button. The window is called a tooltip. Each button on the toolbar displays a tooltip when the mouse pointer hovers over it. You can hide the toolbar by clearing the Toolbar option on the Simulink View menu.

Generating a Sine Wave To create this model, you need to copy blocks into the model from the following Simulink block libraries.



Sources library (the Sine Wave block)



Sinks library (the Scope block)

Now drag the Sine Wave block from the browser and drop it in the model window. Simulink creates a copy of the Sine Wave block at the point where you dropped the node icon.

On the dialog box that appears, notice that the Stop time is set to 10.0 (its default value), changes it’s into inf.

5.4: Simulation parameters First, set the simulation parameters by choosing Simulation Parameters from the Simulation menu. Set simulation stop time to INF. Now, open the Scope block to view the simulation output. Keeping the Scope window open, set up Simulink to run the simulation for infinite seconds

Figure 5.5: Simulink scope graph

Starting Up Simulink: With MATLAB running there are two ways to start Simulink.



You may click on the Simulink icon



You may enter the command simulink at the MATLAB prompt.

or Library Browser in the MATLAB toolbar.

Once the "Simulink" folder has been opened, the Library Browser window should look like

Basic Elements: There are two major classes of items in Simulink: blocks and lines. Blocks are used to generate, modify, combine, output, and display signals. Lines are used to transfer signals from one block to another. Blocks: There are several general classes of blocks: 

Sources: Used to generate various signals



Sinks: Used to output or display signals



Discrete: Linear, discrete-time system elements (transfer functions, state-space models, etc.)



Linear: Linear, continuous-time system elements and connections (summing junctions, gains, etc.)



Nonlinear: Nonlinear operators (arbitrary functions, saturation, delay, etc.)



Connections: Multiplex, Demultiplex, System Macros, etc.

Blocks have zero to several input terminals and zero to several output terminals. Unused input terminals are indicated by a small open triangle. Unused output terminals are indicated by a small triangular point. The block shown below has an unused input terminal on the left and an unused output terminal on the right.

Lines: Lines transmit signals in the direction indicated by the arrow. Lines must always transmit signals from the output terminal of one block to the input terminal of another block. On exception to this is a line can tap off of another line, splitting the signal to each of two destination blocks, as shown below

Building a System To demonstrate how a system is represented using Simulink, we will build the block diagram for a simple model consisting of a sinusoidal input multiplied by a constant gain, which is shown below:

This model will consist of three blocks: Sine Wave, Gain, and Scope. The Sine Wave is a Source Block from which a sinusoidal input signal originates. This signal is transferred through a line in the direction indicated by the arrow to the Gain Math Block. The Gain block modifies its input signal (multiplies it by a constant value) and outputs a new signal through a line to the Scope block. The Scope is a Sink Block used to display a signal (much like an oscilloscope).We begin building our system by bringing up a new model window in which to create the block diagram. This is done by clicking on the "New Model" button in the toolbar of the Simulink Library Browser (looks like a blank page). Building the system model is then accomplished through a series of steps:

1. The necessary blocks are gathered from the Library Browser and placed in the model window. 2. The parameters of the blocks are then modified to correspond with the system we are modelling. 3. Finally, the blocks are connected with lines to complete the model. Gathering Blocks: Each of the blocks we will use in our example model will be taken from the Simulink Library Browser. To place the Sine Wave block into the model window, follow these steps: 1. Click on the "+" in front of "Sources" (this is a subfolder beneath the "Simulink" folder) to display the various source blocks available for us to use. 2. Scroll down until you see the "Sine Wave" block. Clicking on this will display a short explanation of what that block does in the space below the folder list:

3. To insert a Sine Wave block into your model window, click on it in the Library Browser and drag the block into your workspace. The same method can be used to place the Gain and Scope blocks in the model window. The "Gain" block can be found in the "Math" subfolder and the "Scope" block is located in the "Sink" subfolder. Arrange the three blocks in the workspace (done by selecting and dragging an individual block to a new location) so that they look similar to the following:

Simulink allows us to modify the blocks in our model so that they accurately reflect the characteristics of the system we are analyzing. For example, we can modify the Sine Wave block by double-clicking on it. Doing so will cause the following window to appear:

This window allows us to adjust the amplitude, frequency, and phase shift of the sinusoidal input. The "Sample time" value indicates the time interval between successive readings of the signal. Setting this value to 0 indicates the signal is sampled continuously. Let us assume that our system's sinusoidal input has:   

Amplitude = 2 Frequency = pi Phase = pi/2

Next, we modify the Gain block by double-clicking on it in the model window. The following window will then appear:

For our system, we will let k = 5. Enter this value in the "Gain" field, and click "OK" to close the window. Connecting the Blocks: Lines are drawn by dragging the mouse from where a signal starts (output terminal of a block) to where it ends (input terminal of another block). When drawing lines, it is important to make sure that the signal reaches each of its intended terminals. Simulink will turn the mouse pointer into a crosshair when it is close enough to an output terminal to begin drawing a line, and the pointer will change into a double crosshair when it is close enough to snap to an input

terminal. A signal is properly connected if its arrowhead is filled in. If the arrowhead is open, it means the signal is not connected to both blocks.

Running the Simulation: Now that our model has been constructed, we are ready to simulate the system. To do this, go to the Simulation menu and click on Start, or just click on the "Start/Pause Simulation" button in the model window toolbar. Double-click the Scope block to view the output of the Gain block for the simulation as a function of time. Once the Scope window appears, click the "Autoscale" button in its toolbar (looks like a pair of binoculars) to scale the graph to better fit the window. Having done this, you should see the following

Example 2: The second model consists of three blocks: Step, Transfer Fcn, and Scope. The Step is a source block from which a step input signal originates. This signal is transfered through the line in the direction indicated by the arrow to the Transfer Function linear block. The Transfer Function modifies its input signal and outputs a new signal on a line to the Scope. The Scope is a sink block used to display a signal much like an oscilloscope.

A block can be modified by double-clicking on it. For example, if you double-click on the "Transfer Fcn" block in the second model, you will see the following dialog box.

This dialog box contains fields for the numerator and the denominator of the block's transfer function. By entering a vector containing the coefficients of the desired numerator or denominator polynomial,

the desired transfer function can be entered. For example, to change the denominator to s^2+2s+1, enter the following into the denominator field: [1 2 1] and hit the close button, the model window will change to the following,

Then, to start the simulation, either select Start from the Simulation menu (as shown below) or hit Ctrl-T in the model window.

The simulation should run very quickly and the scope window will appear as shown below.

Lab Task:

1) Draw the following circuit on Simulink. Perform Modulation and Demodulation of message signal using Simulink.

2) Design the following model on Simulink (modulation and demodulation of multiple message signal with frequencies 20, 40, 60).Set the parameter values for each block to achieve the original message signal after demodulation.

Draw and execute the following circuits in Matlab Simulink Circuit 1:

Output values and Waveform

Circuit 2:

Output values and Waveform

Circuit 3:

Output values and Waveform

Task: Take two different even functions and add them.

Take two different odd functions and multiply them.

Conclusion: ……………………………………………………………………………………………………………… ……………………………………………………………………………………………………………… ………………

Rubrics Experiment 5: Performance Indicator

Excellent

Very Good

Good

Satisfactory

Marks Subject Knowledge

5 Excellent background knowledge the goals crystal clear

4 Background knowledge is very good and explained well Step-wise procedure is adopted reasonably well and well described. Almost complete experiment is conducted independent ly Results are correct, complete and partially summarized Report is completed in all aspects (including organization , format and information )

3 Good background knowledge but not explained well Procedure is adopted and can convey the concept

2 Partial background knowledge

1 No background knowledge

Procedure is partially missing and main steps are not well described.

No procedure is given

Most of the steps are conducted independent ly

Most of the steps are conducted with help from the instructor

Results are correct, complete but not summarized

Results are incomplete/partia lly incorrect and not summarized

Unable to complete a single step of the experiment independent ly Results not provided

Report is organized and provides all the relevant information but format is not correct

Report is organized and provides partial relevant information, format is not correct

and are

Procedure

Step-wise procedure is very well adopted and very well described

Execution/ Implementati on

Complete experiment conducted independently

Results/ Conclusion

Results are correct, complete, and summarized in detail

Lab Report

Report is completed in all aspects (including organization, format, and information), the presentation of report is also excellent with no grammatical/spell ing mistakes

is

Poor

Report is badly organized and important relevant information is missing

Total (25)

Obtaine d Marks...


Similar Free PDFs