Main Content

Normalize data

returns the vectorwise `N`

= normalize(`A`

)*z*-score of the data in `A`

with
center 0 and standard deviation 1.

If

`A`

is a vector, then`normalize`

operates on the entire vector.If

`A`

is a matrix, table, or timetable, then`normalize`

operates on each column of data separately.If

`A`

is a multidimensional array, then`normalize`

operates along the first array dimension whose size does not equal 1.

specifies the type of normalization for the given method. For example,
`N`

= normalize(___,`method`

,`methodtype`

)`normalize(A,'norm',Inf)`

normalizes the data in
`A`

using the infinity norm.

uses the `N`

= normalize(___,'center',`centertype`

,'scale',`scaletype`

)`'center'`

and `'scale'`

methods at the
same time. These are the only methods you can use together. If you do not specify
`centertype`

or `scaletype`

, then normalize
uses the default method type for that method (centering to have a mean of 0 and
scaling by the standard deviation).

Use this syntax with any center and scale type to perform both methods together.
For instance, `N = normalize(A,'center','median','scale','mad')`

.
You can also use this syntax to specify center and scale values
`C`

and `S`

from a previously computed
normalization. For instance, normalize one data set and save the parameters with
`[N1,C,S] = normalize(A1)`

. Then, reuse those parameters on a
different data set with ```
N2 =
normalize(A2,'center',C,'scale',S)
```

.