Biomedical Engineering Reference
In-Depth Information
FIGURE A.3 The function y ¼ 210
p e 2 t sin (
p t
) graphed using the MATLAB “plot” command.
It is also possible to plot two functions on a graph using the “plot” command. To plot
f ¼
210
p
p
2
e t and
e 2 t sin (
100
y ¼
) on the same graph, enter the following:
t
>>
t
¼
linspace(0, 8, 1000);
>>
y
¼
297 * sin (1.414 * t). * exp(
2 * t);
>>
f
¼
100 * exp(
t);
>>
plot(t, y, t, f)
which generates the graph in Figure A.4. As before, the graph is fully customizable, with
the line color, line styles, fonts, axes labels, axes, etc., changed to the user's needs.
There are many more plotting functions available within MATLAB, including three-
dimensional graphs, histograms, pie charts, etc. The reader is directed to the Help function
in MATLAB to discover all of the plotting capabilities.
Plotting with Microsoft Excel
While MATLAB provides very good plotting capabilities, exporting the data to other
applications such as Microsoft W Excel gives graphics a more professional appearance. Before
plotting the data in Excel, we need to first export the data from MATLAB and then import it
into Excel. All data in MATLAB is stored under variable names in a common workspace
accessible to all toolboxes, including SIMULINK. All variables used in the MATLAB work-
space are given by the “who” or “whos” command. The “who” command simply lists the
variables and the “whos” command lists the variables along with their sizes, number of bytes
used, and class (i.e., logical character, integer array, floating point number array).
Search WWH ::




Custom Search