From ControlTheoryPro.com
(Created page with "{{Header:Category:MATLABPlot CommandAll MATLAB ArticlesMATLAB's Plot Command}} Category:MATLAB ==Introduction== The ''simplot'' command is used to plot Simulink mode...") 

Line 1:  Line 1:  
{{Header:Category:MATLABPlot CommandAll MATLAB ArticlesMATLAB's Plot Command}}  {{Header:Category:MATLABPlot CommandAll MATLAB ArticlesMATLAB's Plot Command}}  
[[Category:MATLAB]]  [[Category:MATLAB]]  
+  [[Category:Modeling:Simulink]]  
==Introduction==  ==Introduction== 
Latest revision as of 19:08, 15 April 2013

Contents
1 Introduction
The simplot command is used to plot Simulink model output data. When using simplot with saved Scope data (using the Struture with Time option) simplot will plot the Simulink data in the same form as would be displayed by the scope. This includes plotting the data with signal labels.
2 Basic Simplot
The most basic way to use simplot is to use simplot on data saved by a Scope block. Scope data can be plotted with the following comand
>> simplot(data);
The data to be plotted can be either a data structure or a matrix of the form produced by Simulink output blocks.
2.1 Time & Data
If the data is in separate time and data vectors than it can be plotted via simplot using the command below.
>> simplot(time, data);
2.2 Structure with Time
When saving data using a scope block there are a couple of options for saving that data. One of those options is the Structure with Time. The Structure with Time option saves the data to a structure with time, signal labels, and other useful information from the Simulink model.
3 Specifying Ports
The data can be saved using several standard blocks. When the data is a structure produced by a Scope block with multiple ports, the data from each port is displayed in a separate subplot. Specific ports can be selected for display by supplying a vector of port indices.
>> ports = [1,3]; >> simplot(data,ports)
4 Comparing Runs
There are a number of reasons for comparing the results of multiple simulation runs. Trade studies and answering proposal questions common reasons for comparing the results of one simulation run to another. The following subheadings detail two uses.
4.1 Overlay plots
With multiple data runs the data needs to be saved to a cell array. The cell array of data structure (Structure with Time) is processed by the simplot command.
>> data = {run1, run2}; >> simplot(data)
This command will overlay the results data from multiple simulation runs.
4.2 Difference between runs
Using simplot as below, MATLAB uses it to compare every run to the first run.
>> data = {run1, run2}; >> simplot(data, 'diff')