Biomedical Engineering Reference
In-Depth Information
MATLAB has commands among its features in this toolbox that determine the exact
symbolic solution for a derivative or an integral of a function and for differential equations.
For example, if we want to compute the derivative of tan (
2 ), MATLAB provides the
t
2 ) 2 ). In this section, we introduce a few of these features, which are
appropriate for solving problems in this chapter.
Before performing symbolic computations, we need to declare all of the symbolic
variables. To write a symbolic variable we enclose it between single quotation marks
using the “sym” MATLAB command or use the “syms” command. For example, the
command
>>
answer 2
t
(1
þ
tan(
t
sym('y')
creates a symbolic variable “y”. Instead of defining a symbolic variable using the
“sym” command, we can write it directly by writing the function within single quotes
as follows:
y
¼
'tan(t 2)'
>>
f
¼
f
¼ tan(t 2)
which creates a symbolic variable “f” that is stored in memory as “tan (t 2)”. To declare
more than one symbolic variable, use the “syms” command. For example,
>>
syms x y w z
or as
>>
syms('w', 'x', 'y', 'z')
declares two four symbolic variables. This command is equivalent to the “sym”
command for each variable separately. Whenever a symbolic variable is used after it is
declared as a symbolic variable, any function using it is also a symbolic function. For
example,
tan(y 2)
f
>>
f
¼
tan (y 2)
'tan(t 2)'
(with single quotes) because “y” is already declared as a symbolic variable. These variables
are now available to be used with any MATLAB command to create symbolic results. With
“w”, “x”, “y”, and “z” declared as symbolic variables, we can create a symbolic determi-
nant by using a symbolic matrix using the MATLAB “det” command as follows:
Notice that in the previous MATLAB command, we did not need to write f
¼
>>
m
¼
[w, x;y, z]
m
[w, x]
[y, z]
>>
det(m)
ans
w * z
x * y
Search WWH ::




Custom Search