padto(x,n), x a REAL vector or matrix, n > 0 an integer |

padto(x,n) creates a new matrix or vector from REAL vector or matrix x by adding n - nrows(x) rows of all zeros so as to bring the total number of rows to n. When n < nrows(x), the last nrows(x) - n rows of x are deleted to bring the number down to n. n must be a positive integer. The principal use of padto() is to add zeros to a time series after subtracting the mean or other estimate of trend but before computing its Fourier transform, as in rft(padto(x-sum(x)/nrows(x),S)), where S is the number of frequencies desired. If x has several columns, they all get padded simultaneously. Example: Cmd> padto(vector(1,2,2)',4) # pad row vector to matrix with 4 rows (1,1) 1 2 2 (2,1) 0 0 0 (3,1) 0 0 0 (4,1) 0 0 0

Gary Oehlert 2003-01-15