Tuesday, July 10, 2012

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

No comments:

Post a Comment

Feature box

HOT