Biomedical Engineering Reference
In-Depth Information
To invert matrix A , given by
>>
A
¼
[596;323;591]
type
>>
inv(A)
MATLAB returns with
B
B
¼
¼
0
:
2941
0
:
5294
0
:
1765
0
:
1412
0
:
2941
0
:
0353
2000
There are many special functions within MATLAB like the exponential and p. For example,
to use p in a calculation, we use the word “pi”; enter the following and note the response.
>>
0
:
2000
0
0
:
pi
ans
¼ 3.1416
MATLAB returns a numerical result for each command entered. The exponential function
uses the syntax “exp (
0.5)”, which, when entered, gives 0.6065. Most standard elementary
functions in a good scientific calculator, including built-in functions, are included in
MATLAB, like the sine and cosine functions. The entire list of MATLAB functions is given
from the “HELP” menu: select “MATLAB HELP”, then “Functions - Alphabetical List”.
A.1.3 Arithmetic Expressions
Arithmetic operations are carried out in MATLAB with the following symbols:
= nþ
*
for power operator, multiplication, right division, left division, addition, and subtraction,
respectively. Note that 1/4 and 4\1 both equal 0.25, and represent 1 divided by 4 and 4
divided into 1, respectively. We often use the “\” operation when solving simultaneous
equations as in Example A.6.
MATLAB performs operations in the order previously listed, that is, first, then * or / or \
calculated in order from left to right, and then
þ
or
calculated in order from left to right.
For example,
>>
6 2 * 3/7 * 2
5
þ
gives
ans
¼ 35.8571
This operation is done by first calculating 6 2
36, then multiplying 36 by 3, followed by
dividing this result by 7, then multiplying the entire result by 2, and then finally adding 5.
The sequence of like math operations works from left to right, with parentheses used to
change the order of calculation. For example,
¼
Search WWH ::




Custom Search