Model Predictive Control Toolbox | ![]() ![]() |
Scales a matrix automatically or by specified mean and standard deviation.
Syntax
[ax,mx,stdx] = autosc
(x)
sx = scal(x,mx)
sx = scal(x,mx,stdx)
rx = rescal(x,mx)
rx = rescal(x,mx,stdx)
Description
autosc
scales an input matrix or vector x
by its column means (mx
) and standard deviations (stdx
) automatically and outputs mx
and stdx
as options. By using scal
, the input can also be scaled by some specified means and/or standard deviations. rescal converts scaled data back to original data.
Output mx
is a row vector containing the mean value for each column of x
while stdx
is a row vector containing the standard deviation for each column. Outputs ax
and sx
are obtained by dividing the difference of each column of x
and the mean for the column by the standard deviation for the column, i.e., ax(:,i) = (x :,i) - mx(i)/stdx(i)
. Output rx
is determined by multiplying each column of x
by the corresponding standard deviation and adding the corresponding mean to that product.
If only two arguments are specified in scal
or rescal
, x
is scaled by specified means (mx
) only.
Example
See mlr
for an example of the use of these functions.
![]() | appmod | cmpc | ![]() |