Name

CL_rMod — Modulo between 2 values

Calling Sequence

   [y] = CL_rMod(x, a, b)
   [y] = CL_rMod(x, a)
   
   

Parameters

x:

Vector of real values (1 x n)

a:

Minimum value (1 x 1) or (1 x n)

b:

Maximum value (strictly superior to a) (1 x 1) or (1 x n)

y:

Result of "x modulo (b-a)" given in the interval [a,b] (1 x n)

Description

  • The result of this function is such as y = x modulo [b-a] and a <= y < b that is to say y = x + k*(b-a) with k integer and a <= y < b

    Note : x can be a row or a column, a and b can be a scalar or a vector of dimension identical to x.

    If b is omitted, then the result is a positive modulo : y = pmodulo(x,a)

Authors

CNES - DCT/SB

See also

Examples

// 20 modulo %pi-(-%pi)=2*%pi, given between -%pi and %pi
x=20;
a=-%pi;
b=%pi;
[y] = CL_rMod(x, a, b)
// 20 modulo 2*%pi, given between 0 and 2%pi
x=20;
a=2*%pi;
[y] = CL_rMod(x, a)