Page 23 - Applied Numerical Methods Using MATLAB
P. 23
12 MATLAB USAGE AND COMPUTATIONAL ERRORS
Table 1.3 Functions and Variables Inside MATLAB
Function Remark Function Remark
cos(x) exp(x) Exponential function
sin(x) log(x) Natural logarithm
tan(x) log10(x) Common logarithm
−1
acos(x) cos (x) abs(x) Absolute value
−1
asin(x) sin (x) angle(x) Phase of a complex
number [rad]
−1
atan(x) −π/2 ≤ tan (x) ≤ π/2 sqrt(x) Square root
−1
atan2(y,x) −π ≤ tan (y, x) ≤ π real(x) Real part
x
cosh(x) (e + e −x )/2 imag(x) Imaginary part
x
sinh(x) (e − e −x )/2 conj(x) Complex conjugate
x
x
tanh(x) (e − e −x )/(e + e −x ) round(x) The nearest integer
(round-off)
−1
acosh(x) cosh (x) fix(x) The nearest integer
toward 0
−1
asinh(x) sinh (x) floor(x) The greatest integer
≤ x
−1
atanh(x) tanh (x) ceil(x) The smallest integer
≥ x
max Maximum and its index sign(x) 1(positive)/0/-
1(negative)
min Minimum and its index mod(y,x) Remainderofy/x
sum Sum rem(y,x) Remainderofy/x
prod Product eval(f) Evaluate an expression
norm Norm feval(f,a) Function evaluation
sort Sort in the ascending polyval Value of a polynomial
order function
clock Present time poly Polynomial with given
roots