Biomedical Engineering Reference
In-Depth Information
The MATLAB commands “diff” and “int” are the symbolic derivative and the indefinite
integral functions, respectively. The following illustrates these two symbolic functions with
some common expressions.
>>
x
¼
diff('cos(y)')
x
¼
sin(y)
and
>>
x
¼
int('sin(y)')
x
¼
cos(y)
Sometimes the result of a MATLAB operation gives an answer that is not easily recogniz-
able. The MATLAB command “simplify” algebraically simplifies the result to a form that
is more readily recognized. For example,
simplify((x 2
>>
þ
7 * x
þ
12)/(x
þ
4) )
¼ x
þ
3
As we will see, this command is very useful during integration and differentiating
operations.
MATLAB also calculates definite integrals by including the limits of integration as argu-
ments in the “int” command. For example, to calculate R
p
cos (
y Þ dy
, we use the following
0
MATLAB command
>>
x
¼
int('sin(y)', '0', 'pi')
x
2
The limits of integration do not have to be numbers, but can be symbolic variables. For
example,
>>
x
¼
int('sin(y)', 'a', 'b')
x
¼
cos(a)
The “solve” command is convenient for solving symbolic algebraic expressions. For
example, to solve for the roots of the polynomial
cos(b)
þ
4
3
2
x
þ
14
x
þ
71
x
þ
154
x þ
120
¼
0, we use
solve('x 4
14 * x 3
71 * x 2
>>
þ
þ
þ
154 * x
þ
120
¼
0')
ans
¼
[
5]
[
4]
[
3]
[
2]
Recall from the previous chapter that we could calculate the roots of a polynomial using the
“roots” command, that is
Search WWH ::




Custom Search