Biomedical Engineering Reference
In-Depth Information
the change. Double-clicking on the scope icon opens a new window that contains a graph for the
output variable. A scope is also drawn for the pulse input as good practice to ensure that the input
is correctly specified. The binocular icon on the menu of the scope graph auto scales the graph.
The “Clock” block from the “Sources” library is used to output the simulation time at each sim-
ulation step. To move the simulation data from SIMULINK to the MATLAB workspace for further
analysis and plotting, the “To Workspace” block is used from the “Sinks” library. Three “To
Workspace” blocks are used in the example to output data for the variables
.
The “To Workspace” writes the data to an array specified by the block's “Variable name”. By
default, the “To Workspace” uses the “Variable name” “simout” for the first, “simout2” for the
second, and so on. These names are easily renamed by double-clinking on the block and entering
meaningful names, such as y1, y2, and Time in this example. While the block is open, the “Save
format” should be changed to “Array” and the “Sample Time” to a number that provides enough
data points. In this example, the simulation time is 20, so the sample time is set at .2 to provide 100
data points for each variable in the MATLAB workspace. Once in the workspace, one can manip-
ulate or plot the variables, i.e., using the MATLAB command “plot(Time, y1)”.
y 1 ,
y 2 , and
Time
Continued
Search WWH ::




Custom Search