Biomedical Engineering Reference
In-Depth Information
TABLE A.2
MATLAB Commands for Polynomials
Operation
Symbolic Expression
Syntax
a n x n þ a n 1 x n 1
Polynomial
þþ a 1 x þ a 0
P
¼
[a n a n1
a 1 a 0 ]
Roots of a polynomial
(
x r 1 )(
x r 2 )
(
x r n )
r
¼
roots(P)
a n x n þ a n 1 x n 1
Write a polynomial from
the roots
þþ a 1 x þ a 0
poly(r)
a n x n þ a n 1 x n 1
Multiply two polynomials
S
S
(
x
)
¼
(
þþ a 1 x þ a 0 )
S
¼
conv(A, B)
b m x m þ b m 1 x m 1
(
x
)
¼ A
(
x
)
B
(
x
)
(
þþ b 1 x þ b 0 )
a n x n þ a n 1 x n 1
Add two polynomials
S
(
)
¼
(
þþ a 1 x þ a 0 )
þ
S
¼
A
þ
B
S
x
x n þþ b m x m þ b m 1 x m 1
); note
that the order of the
polynomials must be the
same
(
)
¼ A
(
)
þ B
(
(0
þþ b 1 x þ b 0 )
x
x
x
x Þ¼ a n x n þ a n 1 x n 1
þþ a 1 x þ a 0
b m x m þ b m 1 x m 1
þþ b 1 x þ b 0 ¼ q p x p þþ q
S
(
x þ q
1
0
Divide two polynomials
S
[Q, V]
¼
deconv(A, B)
v l x l þþ v
¼ A ( x Þ
x þ v
1
0
(
x
)
B ( x Þ ¼ Q
(
x
)
þ V
(
x
);
þ
b m x m þ b m 1
x m 1
þþ b
1
x þ b
0
A.1.7 Plotting with MATLAB
MATLAB has extensive plotting capabilities for two- and three-dimensional graphing of
vectors and matrices for data visualization and presentation graphics. The appearance of
the graphs, including line widths, color, annotations, and labeling can be customized to
meet the needs of the user.
fplot
The basic plotting command in MATLAB is “fplot('f', [T 1 ,T 2 ])”, which plots the function
f
T 2 . Note that the expression “f” is placed within apostrophes so that
MATLAB associates this as a string expression rather than a function to be evaluated at
time “t”. Consider the plotting
over the interval
T 1 to
e t
f ¼
2
in the interval 0 to 5 using MATLAB. We enter
the following command:
>>
fplot('2 * exp(
t)', [0, 5])
in the time interval from 0 to 5 in a separate
window as shown in Figure A.2. To edit the properties of the plot shown in Figure A.2,
select the arrow icon (next to the print icon) and then double-click on the graph. Another
command window opens whereby one can change the color of the line, line styles, fonts,
axes labels, axes, etc.
Graphs are easily moved fromMATLAB to other applications by copying the graph to the
clipboard (Edit, Copy Fig.) and then pasting it into another application such as Microsoft W
Word. One has control of the graph copied to the clipboard by editing the Copy Options
from the Edit menu. The “Metafile” format copies the graph without background color.
The “Bitmap” option copies an exact replica of the graph including the background color.
The command “fplot” graphs the function
f
Search WWH ::




Custom Search