recserrc#

Purpose#

Computes a recursive series involving division.

Format#

y = recserrc(x, z)#
Parameters:
  • x (1xK or Kx1 vector) – data

  • z (NxK matrix) – data

Returns:

y (NxK matrix) –

Each column is a series generated by a recursion of the form:

y[1] = x mod z[1], x = trunc(x/z[1])
y[2] = x mod z[2], x = trunc(x/z[2])
y[3] = x mod z[3], x = trunc(x/z[3])
   .
   .
   .
y[n] = x mod z[n]

Examples#

x = 2|8|10;
b = 2;
n = maxc(log(x)./log(b) ) + 1;
z = reshape(b, n, rows(x));
y = rev(recserrc(x, z) )';

The result, y, will contain in its rows (note that it is transposed in the last step) the digits representing the decimal numbers 2, 8, and 10 in base 2:

0 0 1 0
1 0 0 0
1 0 1 0

Remarks#

Can be used to convert from decimal to other number systems (radix conversion).

Source#

recserrc.src

See also

Functions recserar(), recsercp(), recserVAR()