Tuesday, July 10, 2012

Simulink and its Relation to MATLAB Tutorial

The MATLAB® and Simulink® environments are integrated into one entity, and thus we can analyze, simulate, and revise our models in either environment at any point. We invoke Simulink from within MATLAB. We begin with a few examples and we will discuss generalities in subsequent chapters. Throughout this text, a left justified horizontal bar will denote the beginning of an example, and a right justified horizontal bar will denote the end of the example. These bars will not be shown whenever an example begins at the top of a page or at the bottom of a page. Also, when one example follows immediately after a previous example, the right justified bar will be omitted.

Example 1.1


Download Here   Simulink and its Relation to MATLAB Tutorial

Running a Demo Model In Simulink Tutorial

An interesting demo program provided with Simulink models the thermodynamics of a house. To run this demo, follow these steps:
1 Start MATLAB. See yourMATLAB documentation if you’re not sure how to do this.
2 Run the demo model by typing thermo in the MATLAB command window. This command starts up Simulink and creates amodel window that contains this model.

When you open the model, Simulink opens a Scope block containing two plots labeled Indoor vs. Outdoor Temp and Heat Cost ($), respectively. 3 To start the simulation, pull down the Simulation menu and choose th Start command (or, on Microsoft Windows, press the Start button on the Simulink toolbar). As the simulation runs, the indoor and outdoor temperatures appear in the Indoor vs. Outdoor Temp plot and the cumulative heating cost appears in the Heat Cost ($) plot.

4 To stop the simulation, choose the Stop command from the Simulation menu (or press the Pause button on the toolbar). If you want to explore other parts of the model, look over the suggestions in “Some Things to Try”
5 When you’re finished running the simulation, close the model by choosing Close from the File menu.

Description of the Demo In Simulink

The demo models the thermodynamics of a house using a simple model. The thermostat is set to 70 degrees Fahrenheit and is affected by the outsid temperature, which varies by applying a sine wave with amplitude of 15 degrees to a base temperature of 50 degrees. This simulates daily temperature fluctuations. The model uses subsystems to simplify the model diagram and create reusable systems. A subsystem is a group of blocks that is represented by a Subsystem block. Thismodel contains five subsystems: one named Thermostat, one named House, and three Temp Convert subsystems (two convert Fahrenheit to
Celsius, one converts Celsius to Fahrenheit). The internal and external temperatures are fed into the House subsystem, which updates the internal temperature. Double-click on the House block to see the underlying blocks in that subsystem


.The Thermostat subsystem models the operation of a thermostat, determining when the heating system is turned on and off. Double-click on the block to see the underlying blocks in that subsystem.

Analyzing Simulation Results Tutorial

Viewing Output Trajectories  Simulation Results Tutorial

Output trajectories from Simulink can be plotted using one of three methods:

•Feeding a signal into either a Scope or an XY Graph block
•Writing output to return variables and using MATLAB plotting commands
•Writing output to the workspace using ToWorkspace blocks and plotting the results using MATLAB plotting commands

Using the Scope Block  Simulation Results Tutorial

You can use display output trajectories on a Scope block during a simulation. This simple model shows an example of the use of the Scope block.

Simulation Tutorial
The display on the Scope shows the output trajectory. The Scope block enables you to zoomin on an area of interest or save the data to the workspace. The XY Graph block enables you to plot one signal against another.

Using Return Variables  Simulation Results Tutorial

By returning time and output histories, you can use MATLAB plotting commands to display and annotate the output trajectories.

The block labeled Out is an Outport block from the Signals & Systems library. The output trajectory, yout, is returned by the integration solver

You can also run this simulation from the Simulation menu by specifying variables for the time, output, and states on the Workspace I/O page of the Simulation Parameters dialog box. You can then plot these results using:
                                    plot(tout,yout)

Using the To Workspace Block

 Using the To Workspace BlocThe To Workspace block can be used to return output trajectories to the MATLAB workspace. The model below illustrates this use


The variables y and t appear in the workspace when the simulation is complete. The time vector is stored by feeding a Clock block into a To Workspace block. The time vector can also be acquired by entering a variable name for the time on the Workspace I/O page of the Simulation Parameters dialog box for menu-driven simulations, or by returning it using the sim command (see Chapter 4 for more information).
The To Workspace block can accept a vector input, with each input element’s trajectory stored as a column vector in the resulting workspace variable.


Analyzing Simulation Results Tutorial

Interactive MATLAB & Simulink Based Tutorials

The following interactive tutorials are especially designed for students. Faculty may use this material to supplement their courses. The tutorials are narrated by engineers from MathWorks and include several interactive exercises to reinforce learning.

MATLAB Tutorial (Approximately 120 minutes total; 10 minutes average for each module)

Simulink Tutorial (Approximately 135 minutes total; 10 minutes average for each module)

Signal Processing Tutorial (Approximately 150 minutes total; 12 minutes average for each module)

  • Learn to use MATLAB, Simulink, and Signal Processing Toolbox for designing and simulating signal processing systems. Start now!
    • Some knowledge of MATLAB and Simulink is required; the MATLAB and Simulink tutorials fill this prerequisite
    • Includes Working with Signals, Analysis of Discrete-Time LTI Systems, and Designing Filters Using MATLAB and Simulink
  • Explore other Signal Processing learning resources

Control Systems Tutorial (Approximately 150 minutes total; 12 minutes average for each module )

  • Learn to use MATLAB, Simulink, and Control System Toolbox for modeling, analyzing, and designing control systems. Start now!
    • Some knowledge of MATLAB and Simulink is required; the MATLAB and Simulink tutorials fill this prerequisite
    • Includes Working with Signals, Analysis of Discrete-Time LTI Systems, and Designing Filters Using MATLAB and Simulink
  • Explore other Control Systems learning resources

Computational Mathematics Tutorial (Approximately 160 minutes total; 20 minutes average for each module)

  • Learn to use MATLAB and Optimization Toolbox for applying numerical methods. Start now!
    • Some knowledge of MATLAB and Simulink is required; the MATLAB and Simulink tutorials fill this prerequisite
    • Includes Linear Algebra, Solving Ordinary Differential Equations, Data Fitting and Working with Nonlinear Equations
    • Learn using interesting case studies, such as medical imaging, web page ranking, commodities pricing, spacecraft landing, and electricity consumption data
  • Explore other Computational Mathematics learning resources

Monday, July 9, 2012

Starting Simulink Software Tutorial

Opening the Simulink Library Browser You need MATLAB running before you can open the Simulink Library Browser. 1 Start MATLAB, and then in the MATLAB Command Window, enter simulink The Simulink Library Browser opens.
Simulink Tutorial,

 You can also open the Simulink Library Browser by
• Clicking the Simulink icon on the MATLAB toolbar
• Clicking the Start button on the MATLAB task bar, pointing to Simulink, and then selecting Library Browser

Creating a New Simulink Model

Create a new Simulink model from the Simulink Library Browser.
1 From the Simulink Library Browser menu, select File > New > Model. An empty model opens in the Simulink editor window.

Simulink Tutorial

 2 Select File > Save.
3 In the Save As dialog box, enter a name for your model, and then click Save.
Simulink saves your model with the file extension .mdl.

Feature box

HOT