- •If nu and z are arrays of the same size, the result is also that size.
- •If either input is a scalar, it is expanded to the other input's size.
- •If one input is a row vector and the other is a column vector, the
- •If nu and z are arrays of the same size, the result is also that size.
- •If either input is a scalar, it is expanded to the other input's size.
- •If one input is a row vector and the other is a column vector, the
- •If nu and z are arrays of the same size, the result is also that size.
- •If either input is a scalar, it is expanded to the other input's size.
- •If one input is a row vector and the other is a column vector, the
- •If nu and z are arrays of the same size, the result is also that size.
- •If either input is a scalar, it is expanded to the other input's size.
- •If one input is a row vector and the other is a column vector, the
If nu and z are arrays of the same size, the result is also that size.
If either input is a scalar, it is expanded to the other input's size.
If one input is a row vector and the other is a column vector, the
result is a two-dimensional table of function values.
I = BESSELI(NU,Z,0) is the same as BESSELI(NU,Z).
I = BESSELI(NU,Z,1) scales I_nu(z) by exp(-abs(real(z)))
[I,IERR] = BESSELI(NU,Z) also returns an array of error flags.
ierr = 1 Illegal arguments.
ierr = 2 Overflow. Return Inf.
ierr = 3 Some loss of accuracy in argument reduction.
ierr = 4 Complete loss of accuracy, z or nu too large.
ierr = 5 No convergence. Return NaN.
Examples:
besseli(3:9,(0:.2:10)',1) generates the entire table on page 423
of Abramowitz and Stegun, Handbook of Mathematical Functions.
BESSELI uses a MEX interface to a Fortran library by D. E. Amos.
Class support for inputs NU and Z:
float: double, single
See also besselj, bessely, besselk, besselh.
Reference page in Help browser
doc besseli
<besselk> - Modified Bessel function of the second kind.
BESSELK Modified Bessel function of the second kind.
K = BESSELK(NU,Z) is the modified Bessel function of the second kind,
K_nu(Z). The order NU need not be an integer, but must be real.
The argument Z can be complex. The result is real where Z is positive.
If nu and z are arrays of the same size, the result is also that size.
If either input is a scalar, it is expanded to the other input's size.
If one input is a row vector and the other is a column vector, the
result is a two-dimensional table of function values.
K = BESSELK(NU,Z,0) is the same as BESSELK(NU,Z).
K = BESSELK(NU,Z,1) scales K_nu(z) by exp(z)
[K,IERR] = BESSELK(NU,Z) also returns an array of error flags.
ierr = 1 Illegal arguments.
ierr = 2 Overflow. Return Inf.
ierr = 3 Some loss of accuracy in argument reduction.
ierr = 4 Complete loss of accuracy, z or nu too large.
ierr = 5 No convergence. Return NaN.
Examples:
besselk(3:9,(0:.2:10)',1) generates part of the table on page 424
of Abramowitz and Stegun, Handbook of Mathematical Functions.
BESSELK uses a MEX interface to a Fortran library by D. E. Amos.
Class support for inputs NU and Z:
float: double, single
See also besselj, bessely, besseli, besselh.
Reference page in Help browser
doc besselk
<beta> - Beta function.
BETA Beta function.
Y = BETA(Z,W) computes the beta function for corresponding
elements of Z and W. The beta function is defined as
beta(z,w) = integral from 0 to 1 of t.^(z-1) .* (1-t).^(w-1) dt.
The arrays Z and W must be real and nonnegative. Both arrays must be
the same size, or either can be scalar.
Class support for inputs Z,W:
float: double, single
See also betainc, betaln.
Reference page in Help browser
doc beta
<betainc> - Incomplete beta function.
BETAINC Incomplete beta function.
Y = BETAINC(X,Z,W) computes the incomplete beta function for corresponding
elements of X, Z, and W. The elements of X must be in the closed interval
[0,1], and those of Z and W must be nonnegative. X, Z, and W must all be
real and the same size (or any of them can be scalar).
The incomplete beta function is defined as
I_x(z,w) = 1./BETA(z,w) .*
integral from 0 to x of t.^(z-1) .* (1-t).^(w-1) dt
Y = BETAINC(X,Z,W,TAIL) specifies the tail of the incomplete beta function.
Choices are 'lower' (the default) to compute the integral from 0 to x, or
'upper' to compute the integral from x to 1. These two choices are
related as
BETAINC(X,Z,W,'upper') = 1 - BETAINC(X,Z,W,'lower').
When the upper tail value is close to 0, the 'upper' option provides a way
to compute that value more accurately than by subtracting the lower tail
value from 1.
If either Z or W is very large, BETAINC uses an approximation whose
absolute accuracy is at least 5e-3 if Z+W > 6.
Class support for inputs X,Z,W:
float: double, single
See also betaincinv, beta, betaln.
Reference page in Help browser
doc betainc
<betaincinv> - Inverse incomplete beta function.
BETAINCINV Inverse incomplete beta function.
X = BETAINCINV(Y,Z,W) computes the inverse incomplete beta function for
corresponding elements of X, Z, and W, such that Y = BETAINC(X,Z,W). The
elements of Y must be in the closed interval [0,1], and those of Z and W
must be nonnegative. Y, Z, and W must all be real and the same size (or
any of them can be scalar).
The incomplete beta function is defined as
I_x(z,w) = 1./BETA(z,w) .*
integral from 0 to x of t.^(z-1) .* (1-t).^(w-1) dt
and BETAINCINV computes the inverse of that function with respect to the
integration limit x, using Newton's method.
X = BETAINCINV(Y,A,TAIL) specifies the tail of the incomplete beta
function. Choices are 'lower' (the default) to use the integral from 0 to
x, or 'upper' to use the integral from x to 1. These two choices are
related as follows:
BETAINCINV(Y,Z,W,'upper') = BETAINCINV(1-Y,Z,W,'lower')
When Y is close to 0, the 'upper' option provides a way to compute X more
accurately than by subtracting from Y from 1.
Class support for inputs Y,Z,W:
float: double, single
See also betainc, beta, betaln.
Reference page in Help browser
doc betaincinv
<betaln> - Logarithm of beta function.
BETALN Logarithm of beta function.
Y = BETALN(Z,W) computes the natural logarithm of the beta
function for corresponding elements of Z and W. The arrays Z and
W must be real and nonnegative. Both arrays must be the same size,
or either can be scalar. BETALN is defined as:
BETALN = LOG(BETA(Z,W))
and is obtained without computing BETA(Z,W). Since the beta
function can range over very large or very small values, its
logarithm is sometimes more useful.
Class support for inputs Z,W:
float: double, single
See also betainc, beta.
Reference page in Help browser
doc betaln
<ellipj> - Jacobi elliptic functions.
ELLIPJ Jacobi elliptic functions.
[SN,CN,DN] = ELLIPJ(U,M) returns the values of the Jacobi elliptic
functions Sn, Cn and Dn, evaluated for corresponding elements of
argument U and parameter M. U and M must be arrays of the same
size or either can be scalar. As currently implemented, M is
limited to 0 <= M <= 1.
[SN,CN,DN] = ELLIPJ(U,M,TOL) computes the elliptic functions to
the accuracy TOL instead of the default TOL = EPS.
Some definitions of the Jacobi elliptic functions use the modulus
k instead of the parameter M. They are related by M = k^2.
See also ellipke.
Reference page in Help browser
doc ellipj
<ellipke> - Complete elliptic integral.
ELLIPKE Complete elliptic integral.
[K,E] = ELLIPKE(M) returns the value of the complete elliptic
integrals of the first and second kinds, evaluated for each
element of M. As currently implemented, M is limited to 0 <= M <= 1.
[K,E] = ELLIPKE(M,TOL) computes the complete elliptic integrals to
the accuracy TOL instead of the default TOL = EPS(CLASS(M)).
Some definitions of the complete elliptic integrals use the modulus
k instead of the parameter M. They are related by M = k^2.
Class support for input M:
float: double, single
See also ellipj.
Reference page in Help browser
doc ellipke
<erf> - Error function.
ERF Error function.
Y = ERF(X) is the error function for each element of X. X must be
real. The error function is defined as:
erf(x) = 2/sqrt(pi) * integral from 0 to x of exp(-t^2) dt.
Class support for input X:
float: double, single
See also erfc, erfcx, erfinv, erfcinv.
Reference page in Help browser
doc erf
<erfc> - Complementary error function.
ERFC Complementary error function.
Y = ERFC(X) is the complementary error function for each element
of X. X must be real. The complementary error function is
defined as:
erfc(x) = 2/sqrt(pi) * integral from x to inf of exp(-t^2) dt.
= 1 - erf(x).
Class support for input X:
float: double, single
See also erf, erfcx, erfinv, erfcinv.
Reference page in Help browser
doc erfc
<erfcx> - Scaled complementary error function.
ERFCX Scaled complementary error function.
Y = ERFCX(X) is the scaled complementary error function for each
element of X. X must be real. The scaled complementary error
function is defined as:
erfcx(x) = exp(x^2) * erfc(x)
which is approximately (1/sqrt(pi)) * 1/x for large x.
Class support for input X:
float: double, single
See also erf, erfc, erfinv, erfcinv.
Reference page in Help browser
doc erfcx
<erfinv> - Inverse error function.
ERFINV Inverse error function.
X = ERFINV(Y) is the inverse error function for each element of Y.
The inverse error function satisfies y = erf(x), for -1 <= y <= 1
and -inf <= x <= inf.
Class support for input Y:
float: double, single
See also erf, erfc, erfcx, erfcinv.
Reference page in Help browser
doc erfinv
<expint> - Exponential integral function.
EXPINT Exponential integral function.
Y = EXPINT(X) is the exponential integral function for each
element of X. The exponential integral is defined as:
EXPINT(x) = integral from x to Inf of (exp(-t)/t) dt, for x > 0.
By analytic continuation, EXPINT is a scalar-valued function in
the complex plane cut along the negative real axis.
Another common definition of the exponential integral function is
the Cauchy principal value integral from -Inf to X of (exp(t)/t)
dt, for positive X. This is denoted as Ei(x). The relationships
between EXPINT(x) and Ei(x) are as follows:
EXPINT(-x+i*0) = -Ei(x) - i*pi, for real x > 0
Ei(x) = REAL(-EXPINT(-x)), for real x > 0
Class support for input X:
float: double, single
Reference page in Help browser
doc expint
<gamma> - Gamma function.
GAMMA Gamma function.
Y = GAMMA(X) evaluates the gamma function for each element of X.
X must be real. The gamma function is defined as:
gamma(x) = integral from 0 to inf of t^(x-1) exp(-t) dt.
The gamma function interpolates the factorial function. For
integer n, gamma(n+1) = n! (n factorial) = prod(1:n).
Class support for input X:
float: double, single
See also gammaln, gammainc, gammaincinv, psi.
Reference page in Help browser
doc gamma
<gammainc> - Incomplete gamma function.
GAMMAINC Incomplete gamma function.
Y = GAMMAINC(X,A) evaluates the incomplete gamma function for
corresponding elements of X and A. The elements of A must be nonnegative.
X and A must be real and the same size (or either can be a scalar).
The incomplete gamma function is defined as:
gammainc(x,a) = 1 ./ gamma(a) .*
integral from 0 to x of t^(a-1) exp(-t) dt
For any a>=0, as x approaches infinity, gammainc(x,a) approaches 1. For
small x and a, gammainc(x,a) ~ x^a, so gammainc(0,0) = 1.
Y = GAMMAINC(X,A,TAIL) specifies the tail of the incomplete gamma function
when X is non-negative. Choices are 'lower' (the default) to compute the
integral from 0 to x, or 'upper' to compute the integral from x to
infinity. These two choices are related as
GAMMAINC(X,A,'upper') = 1 - GAMMAINC(X,A,'lower').
When the upper tail value is close to 0, the 'upper' option provides a way
to compute that value more accurately than by subtracting the lower tail
value from 1.
Warning: When X is negative, Y can be inaccurate for abs(X) > A+1.
Class support for inputs X,A:
float: double, single
See also gammaincinv, gamma, gammaln, psi.
Reference page in Help browser
doc gammainc
<gammaincinv> - Inverse incomplete gamma function.
GAMMAINCINV Inverse incomplete gamma function.
X = GAMMAINCINV(Y,A) evaluates the inverse incomplete gamma function for
corresponding elements of Y and A, such that Y = GAMMAINC(X,A). The
elements of Y must be in the closed interval [0,1], and those of A must be
non-negative. Y and A must be real and the same size (or either can be a
scalar).
The incomplete gamma function is defined as:
gammainc(x,a) = 1 ./ gamma(a) .*
integral from 0 to x of t^(a-1) exp(-t) dt
and GAMMAINCINV computes the inverse of that function with respect to the
integration limit x, using Newton's method.
For any a>0, as y approaches 1, gammaincinv(y,a) approaches infinity. For
small x and a, gammainc(x,a) ~= x^a, so gammaincinv(1,0) = 0.
Y = GAMMAINCINV(X,A,TAIL) specifies the tail of the incomplete gamma
function. Choices are 'lower' (the default) to use the integral from 0 to
x, or 'upper' to use the integral from x to infinity. These two choices
are related as
GAMMAINCINV(Y,A,'upper') = GAMMAINCINV(1-Y,A,'lower').
When Y is close to 0, the 'upper' option provides a way to compute X more
accurately than by subtracting Y from 1.
Class support for inputs Y,A:
float: double, single
See also gammainc, gamma, gammaln, psi.
Reference page in Help browser
doc gammaincinv
<gammaln> - Logarithm of gamma function.
GAMMALN Logarithm of gamma function.
Y = GAMMALN(X) computes the natural logarithm of the gamma function
for each element of X. GAMMALN is defined as LOG(GAMMA(X)) and
is obtained without computing GAMMA(X). Since the gamma function
can range over very large or very small values, its logarithm is
sometimes more useful.
Class support for input X:
float: double, single
See also gamma, gammainc, gammaincinv, psi.
Reference page in Help browser
doc gammaln
<psi> - Psi (polygamma) function.
PSI Psi (polygamma) function.
Y = PSI(X) evaluates the psi function for each element of X.
X must be real and nonnegative. SIZE(Y) is the same as SIZE(X).
The psi function, also know as the digamma function, is the logarithmic
derivative of the gamma function:
psi(x) = digamma(x) = d(log(gamma(x)))/dx = (d(gamma(x))/dx)/gamma(x).
Y = PSI(K,X) evaluates the K-derivative of psi at the elements of X.
For real integer-valued scalar K, SIZE(Y) is the same as SIZE(X).
PSI(0,X) is the digamma function, PSI(1,X) is the trigamma function,
PSI(2,X) is the tetragamma function, etc.
Y = PSI(K0:K1,X) evaluates derivatives of order K0 through K1 at X. The
vector K0:K1 must be real and integer-valued. If X is a vector, SIZE(Y) will
be NUMEL(K)-by-LENGTH(X). Otherwise, SIZE(Y) will be NUMEL(K)-by-SIZE(X).
Y(K,J) is the (K-1+K0)-th derivative of psi evaluated at X(J).
Examples:
-psi(1) = -psi(0,1) is Euler's constant, 0.5772156649015323.
psi(1,2) = pi^2/6 - 1.
x = (1:.005:1.250)'; [x gamma(x) gammaln(x) psi(0:1,x)' x-1]
produces the first page of table 6.1 of Abramowitz and Stegun.
psi(2:3,1:.01:2)' is a portion of table 6.2.
Ref: Abramowitz & Stegun, Handbook of Mathematical Functions,
sections 6.3 and 6.4.
See also gamma, gammaln, gammainc.
Reference page in Help browser
doc psi
<legendre> - Associated Legendre function.
LEGENDRE Associated Legendre function.
P = LEGENDRE(N,X) computes the associated Legendre functions
of degree N and order M = 0, 1, ..., N, evaluated for each element
of X. N must be a scalar integer and X must contain real values
between -1 <= X <= 1.
If X is a vector, P is an (N+1)-by-L matrix, where L = length(X).
The P(M+1,i) entry corresponds to the associated Legendre function
of degree N and order M evaluated at X(i).
In general, the returned array has one more dimension than X.
Each element P(M+1,i,j,k,...) contains the associated Legendre
function of degree N and order M evaluated at X(i,j,k,...).
There are three possible normalizations, LEGENDRE(N,X,normalize)
where normalize is 'unnorm','sch' or 'norm'.
The default, unnormalized associated Legendre functions are:
P(N,M;X) = (-1)^M * (1-X^2)^(M/2) * (d/dX)^M { P(N,X) },
where P(N,X) is the Legendre polynomial of degree N. Note that
the first row of P is the Legendre polynomial evaluated at X
(the M == 0 case).
SP = LEGENDRE(N,X,'sch') computes the Schmidt semi-normalized
associated Legendre functions SP(N,M;X). These functions are
related to the unnormalized associated Legendre functions
P(N,M;X) by:
SP(N,M;X) = P(N,X), M = 0
= (-1)^M * sqrt(2*(N-M)!/(N+M)!) * P(N,M;X), M > 0
NP = LEGENDRE(N,X,'norm') computes the fully-normalized
associated Legendre functions NP(N,M;X). These functions are
normalized such that
/1
|
| [NP(N,M;X)]^2 dX = 1 ,
|
/-1
and are related to the unnormalized associated Legendre
functions P(N,M;X) by:
NP(N,M;X) = (-1)^M * sqrt((N+1/2)*(N-M)!/(N+M)!) * P(N,M;X)
Examples:
1. legendre(2, 0.0:0.1:0.2) returns the matrix:
| x = 0 x = 0.1 x = 0.2
---- --|---------------------------------------------
m = 0 | -0.5000 -0.4850 -0.4400
m = 1 | 0 -0.2985 -0.5879
m = 2 | 3.0000 2.9700 2.8800
2. X = rand(2,4,5); N = 2;
P = legendre(N,X);
so that size(P) is 3x2x4x5 and
P(:,1,2,3) is the same as legendre(N,X(1,2,3)).
Class support for input X:
float: double, single
Reference page in Help browser
doc legendre
<cross> - Vector cross product.
CROSS Vector cross product.
C = CROSS(A,B) returns the cross product of the vectors
A and B. That is, C = A x B. A and B must be 3 element
vectors.
C = CROSS(A,B) returns the cross product of A and B along the
first dimension of length 3.
C = CROSS(A,B,DIM), where A and B are N-D arrays, returns the cross
product of vectors in the dimension DIM of A and B. A and B must
have the same size, and both SIZE(A,DIM) and SIZE(B,DIM) must be 3.
Class support for inputs A,B:
float: double, single
See also dot.
Reference page in Help browser
doc cross
<dot> - Vector dot product.
DOT Vector dot product.
C = DOT(A,B) returns the scalar product of the vectors A and B.
A and B must be vectors of the same length. When A and B are both
column vectors, DOT(A,B) is the same as A'*B.
DOT(A,B), for N-D arrays A and B, returns the scalar product
along the first non-singleton dimension of A and B. A and B must
have the same size.
DOT(A,B,DIM) returns the scalar product of A and B in the
dimension DIM.
Class support for inputs A,B:
float: double, single
See also cross.
Overloaded methods:
codistributed/dot
Reference page in Help browser
doc dot
Number theoretic functions
<factor> - Prime factors.
FACTOR Prime factors.
FACTOR(N) returns a vector containing the prime factors of N.
This function uses the simple sieve approach. It may require large
memory allocation if the number given is too big. Technically it is
possible to improve this algorithm, allocating less memory for most
cases and resulting in a faster execution time. However, it will still
have problems in the worst case, so we choose to impose an upper bound
on the input number and error out for n > 2^32.
Class support for input N:
float: double, single
See also primes, isprime.
Overloaded methods:
sym/factor
Reference page in Help browser
doc factor
<isprime> - True for prime numbers.
ISPRIME True for prime numbers.
ISPRIME(X) is 1 for the elements of X that are prime, 0 otherwise.
Class support for input X:
float: double, single
See also factor, primes.
Reference page in Help browser
doc isprime
<primes> - Generate list of prime numbers.
PRIMES Generate list of prime numbers.
PRIMES(N) is a row vector of the prime numbers less than or
equal to N. A prime number is one that has no factors other
than 1 and itself.
Class support for input N:
float: double, single
See also factor, isprime.
Reference page in Help browser
doc primes
<gcd> - Greatest common divisor.
GCD Greatest common divisor.
G = GCD(A,B) is the greatest common divisor of corresponding elements
of A and B. The arrays A and B must contain integer values and must be
the same size (or either can be scalar). GCD(0,0) is 0 by convention;
all other GCDs are positive integers.
[G,C,D] = GCD(A,B) also returns C and D so that G = A.*C + B.*D.
These are useful for solving Diophantine equations and computing
Hermite transformations.
Class support for inputs A,B:
float: double, single
See also lcm.
Overloaded methods:
sym/gcd
Reference page in Help browser
doc gcd
<lcm> - Least common multiple.
LCM Least common multiple.
LCM(A,B) is the least common multiple of corresponding elements of
A and B. The arrays A and B must contain positive integers
and must be the same size (or either can be scalar).
Class support for inputs A,B:
float: double, single
See also gcd.
Overloaded methods:
sym/lcm
Reference page in Help browser
doc lcm
<rat> - Rational approximation.
RAT Rational approximation.
[N,D] = RAT(X,tol) returns two integer matrices so that N./D
is close to X in the sense that abs(N./D - X) <= tol*abs(X).
The rational approximations are generated by truncating continued
fraction expansions. tol = 1.e-6*norm(X(:),1) is the default.
S = RAT(X) or RAT(X,tol) returns the continued fraction
representation as a string.
The same algorithm, with the default tol, is used internally
by MATLAB for FORMAT RAT.
Class support for input X:
float: double, single
See also format, rats.
Reference page in Help browser
doc rat
<rats> - Rational output.
RATS Rational output.
RATS(X,LEN) uses RAT to display rational approximations to
the elements of X. The string length for each element is LEN.
The default is LEN = 13, which allows 6 elements in 78 spaces.
Asterisks are used for elements which can't be printed in the
allotted space, but which are not negligible compared to the other
elements in X.
The same algorithm, with the default LEN, is used internally
by MATLAB for FORMAT RAT.
Class support for input X:
float: double, single
See also format, rat.
Reference page in Help browser
doc rats
<perms> - All possible permutations.
PERMS All possible permutations.
PERMS(1:N), or PERMS(V) where V is a vector of length N, creates a
matrix with N! rows and N columns containing all possible
permutations of the N elements.
This function is only practical for situations where N is less
than about 10 (for N=11, the output takes over 3 giga-bytes).
Class support for input V:
float: double, single
See also nchoosek, randperm, permute.
Reference page in Help browser
doc perms
<nchoosek> - All combinations of N elements taken K at a time.
NCHOOSEK Binomial coefficient or all combinations.
NCHOOSEK(N,K) where N and K are non-negative integers returns N!/K!(N-K)!.
This is the number of combinations of N things taken K at a time.
When a coefficient is large, a warning will be produced indicating
possible inexact results. In such cases, the result is only accurate
to 15 digits for double-precision inputs, or 8 digits for single-precision
inputs.
NCHOOSEK(V,K) where V is a vector of length N, produces a matrix
with N!/K!(N-K)! rows and K columns. Each row of the result has K of
the elements in the vector V. This syntax is only practical for
situations where N is less than about 15.
Class support for inputs N,K,V:
float: double, single
See also perms.
Reference page in Help browser
doc nchoosek
<factorial> - Factorial function.
FACTORIAL Factorial function.
FACTORIAL(N) for scalar N, is the product of all the integers from 1 to N,
i.e. prod(1:N). When N is an N-D matrix, FACTORIAL(N) is the factorial for
each element of N. Since double precision numbers only have about
15 digits, the answer is only accurate for N <= 21. For larger N,
the answer will have the correct order of magnitude, and is accurate for
the first 15 digits.
See also prod.
Reference page in Help browser
doc factorial
Coordinate transforms
<cart2sph> - Transform Cartesian to spherical coordinates.
CART2SPH Transform Cartesian to spherical coordinates.
[TH,PHI,R] = CART2SPH(X,Y,Z) transforms corresponding elements of
data stored in Cartesian coordinates X,Y,Z to spherical
coordinates (azimuth TH, elevation PHI, and radius R). The arrays
X,Y, and Z must be the same size (or any of them can be scalar).
TH and PHI are returned in radians.
TH is the counterclockwise angle in the xy plane measured from the
positive x axis. PHI is the elevation angle from the xy plane.
Class support for inputs X,Y,Z:
float: double, single
See also cart2pol, sph2cart, pol2cart.
Reference page in Help browser
doc cart2sph
<cart2pol> - Transform Cartesian to polar coordinates.
CART2POL Transform Cartesian to polar coordinates.
[TH,R] = CART2POL(X,Y) transforms corresponding elements of data
stored in Cartesian coordinates X,Y to polar coordinates (angle TH
and radius R). The arrays X and Y must be the same size (or
either can be scalar). TH is returned in radians.
[TH,R,Z] = CART2POL(X,Y,Z) transforms corresponding elements of
data stored in Cartesian coordinates X,Y,Z to cylindrical
coordinates (angle TH, radius R, and height Z). The arrays X,Y,
and Z must be the same size (or any of them can be scalar). TH is
returned in radians.
Class support for inputs X,Y,Z:
float: double, single
See also cart2sph, sph2cart, pol2cart.
Reference page in Help browser
doc cart2pol
<pol2cart> - Transform polar to Cartesian coordinates.
POL2CART Transform polar to Cartesian coordinates.
[X,Y] = POL2CART(TH,R) transforms corresponding elements of data
stored in polar coordinates (angle TH, radius R) to Cartesian
coordinates X,Y. The arrays TH and R must the same size (or
either can be scalar). TH must be in radians.
[X,Y,Z] = POL2CART(TH,R,Z) transforms corresponding elements of
data stored in cylindrical coordinates (angle TH, radius R, height
Z) to Cartesian coordinates X,Y,Z. The arrays TH, R, and Z must be
the same size (or any of them can be scalar). TH must be in radians.
Class support for inputs TH,R,Z:
float: double, single
See also cart2sph, cart2pol, sph2cart.
Reference page in Help browser
doc pol2cart
<sph2cart> - Transform spherical to Cartesian coordinates.
SPH2CART Transform spherical to Cartesian coordinates.
[X,Y,Z] = SPH2CART(TH,PHI,R) transforms corresponding elements of
data stored in spherical coordinates (azimuth TH, elevation PHI,
radius R) to Cartesian coordinates X,Y,Z. The arrays TH, PHI, and
R must be the same size (or any of them can be scalar). TH and
PHI must be in radians.
TH is the counterclockwise angle in the xy plane measured from the
positive x axis. PHI is the elevation angle from the xy plane.
Class support for inputs TH,PHI,R:
float: double, single
See also cart2sph, cart2pol, pol2cart.
Reference page in Help browser
doc sph2cart
<hsv2rgb> - Convert hue-saturation-value colors to red-green-blue.
HSV2RGB Convert hue-saturation-value colors to red-green-blue.
M = HSV2RGB(H) converts an HSV color map to an RGB color map.
Each map is a matrix with any number of rows, exactly three columns,
and elements in the interval 0 to 1. The columns of the input matrix,
H, represent hue, saturation and value, respectively. The columns of
the resulting output matrix, M, represent intensity of red, blue and
green, respectively.
RGB = HSV2RGB(HSV) converts the HSV image HSV (3-D array) to the
equivalent RGB image RGB (3-D array).
As the hue varies from 0 to 1, the resulting color varies from
red, through yellow, green, cyan, blue and magenta, back to red.
When the saturation is 0, the colors are unsaturated; they are
simply shades of gray. When the saturation is 1, the colors are
fully saturated; they contain no white component. As the value
varies from 0 to 1, the brightness increases.
The colormap HSV is hsv2rgb([h s v]) where h is a linear ramp
from 0 to 1 and both s and v are all 1's.
See also rgb2hsv, colormap, rgbplot.
Reference page in Help browser
doc hsv2rgb
<rgb2hsv> - Convert red-green-blue colors to hue-saturation-value.
RGB2HSV Convert red-green-blue colors to hue-saturation-value.
H = RGB2HSV(M) converts an RGB color map to an HSV color map.
Each map is a matrix with any number of rows, exactly three columns,
and elements in the interval 0 to 1. The columns of the input matrix,
M, represent intensity of red, blue and green, respectively. The
columns of the resulting output matrix, H, represent hue, saturation
and color value, respectively.
HSV = RGB2HSV(RGB) converts the RGB image RGB (3-D array) to the
equivalent HSV image HSV (3-D array).
CLASS SUPPORT
-------------
If the input is an RGB image, it can be of class uint8, uint16, or
double; the output image is of class double. If the input is a
colormap, the input and output colormaps are both of class double.
See also hsv2rgb, colormap, rgbplot.
Reference page in Help browser
doc rgb2hsv
