polymat#

Purpose#

Returns a matrix containing the powers of the elements of x from 1 to p.

Format#

y = polymat(x, p)#
Parameters:
  • x (NxK matrix) – data

  • p (scalar) – positive integer.

Returns:

y (Nx(p*K) matrix) – contains powers of the elements of x from 1 to p. The first K columns will contain first powers, the second K columns second powers, and so on.

Remarks#

To do polynomial regression use ols:

{ vnam, m, b, stb, vc, stderr, sigma, cx, rsq, resid, dwstat } = ols(0, y, polymat(x, p));

Source#

polymat.src

See also

Functions polychar(), polymult(), polyroot(), polyeval()