<< CL_quantile Math CL_sphHarmGrad >>

CelestLab >> Math > CL_rMod

CL_rMod

Modulo with result in range

Calling Sequence

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

Description

Parameters

x:

Vector or matrix of real values (any size)

a:

Minimum value (1x1 or same size as x)

b:

Maximum value (strictly greater than a) (1x1 or same size as a)

y:

Result of "x modulo (b-a)" belonging to [a,b[ (maximum size between x, a, b)

nrev:

(integer) Number of times "b-a" has been added to x (same size as y)

Authors

Examples

CL_rMod(2*%pi, -%pi, %pi)
[y, nrev] = CL_rMod(1:20, -5, 5);
y - nrev * 10 // => 1 : 20

x = 1:20;
CL_rMod(1, 2*x - 3, 2*x + 3)
CL_rMod(2*x, x - 3, x + 3)

Report an issue
<< CL_quantile Math CL_sphHarmGrad >>