Professional Documents
Culture Documents
Programming
Be
able
to
fully
understand
any
code
in
which
such
functions
are
used.
Be
able
to
use
such
functions
if
you
are
provided
with
their
signature
(Y
=
sin(X)
is
the
signature
of
the
sin
function).
Short-Naming
Conventions
In
this
document,
function
inputs
and
outputs
are
short-named
following
some
simple
rules:
Uppercase
letters
(even
if
suffixed
with
a
number)
represent
matrices
(X,
Y,
A1).
Lowercase
m's
and
n's
(even
if
suffixed
with
a
number)
represent
scalars
(m,
n,
n1).
Lowercase
s's
(even
if
suffixed
with
a
number)
represent
strings
(s,
s1).
Lowercase
letters
different
from
m
and
n
represent
vectors
(d,
f,
p).
When
the
input/output
name
ends
with
"expr",
it
means
that
symbolic
expressions
are
involved.
For
instance,
expr
and
exprOut
represent
a
regular
symbolic
expression,
dExpr
represents
a
vector
containing
symbolic
expressions
and
BExpr
represents
a
matrix
containing
symbolic
expressions.
Keep
function
signatures
as
short
as
the
official
signatures
available
in
the
Matlab
documentation.
Provide
implicit
information
about
function
inputs
and
outputs.
Note
that
these
short-naming
conventions
are
not
the
most
usual
in
Matlab.
Generally,
scalars,
vectors
and
symbolic
expressions
are
not
differentiable
(they
are
all
written
with
a
lowercase
letter).
When
writing
your
own
code,
try
to
avoid
short-naming
variables,
function
inputs
and
outputs.
Instead,
follow
the
guidelines
in
the
Matlab
programming
style
guidelines
notes.
Trigonometry
*
Y
=
sin(X)
Y
=
sind(X)
Y
=
cos(X)
Y
=
cosd(X)
Y
=
tan(X)
Y
=
tand(X)
1 / 4
Computer Programming
Exponential
*
Y
=
exp(X)
Y
=
log(X)
Y
=
log10(X)
Y
=
log2(X)
Y
=
sqrt(X)
Y
=
nthroot(X,
n)
Complex
*
Y
=
abs(X)
Y
=
sign(X)
Constants
*
pi
eps
NaN
Inf
Symbolic
Resolution
(syms
)
exprOut
=
factor(expr)
m
=
limit(expr,
n)
exprOut
=
int(expr)
exprOut
=
int(expr,
n1,
n2)
2 / 4
Computer Programming
In
order
to
use
the
following
functions,
matrices
must
have
been
explained.
Basic
Information
*
Y
=
max(X)
Y
=
min(X)
Analysis
n
=
det(A)
*
n
=
rank(A)
Linear
Equations
B
=
inv(A)
*
X
=
linsolve(A,
B)
*
[L,U]
=
lu(A)
Polynomials
d
=
polyder(p)
y
=
polyval(p,
n)
r
=
roots(p)
w
=
conv(p1,
p2)
[q,
r]
=
deconv(p1,
p2)
p
=
poly(r)
Symbolic
Resolution
(syms
)
dExpr
=
det(AExpr)
3 / 4
Computer Programming
BExpr
=
inv(AExpr)
rExpr
=
solve(expr)
4 / 4