center

Computes zero mean, or centered values.

Syntax

c = center(x)

c = center(x,dim)

Inputs

x
Data sample.
Type: double
Dimension: vector | matrix
dim
Dimension from which to subtract the mean of each vector.
Default: first non-singleton dimension.
Type: integer
Dimension: scalar

Outputs

c
Centered values.
Dimension: scalar | matrix

Examples

Vector example:
x = [9.3, 10.6, 11.9, 13.3, 15.0, 18.2];
c = center(x)
c = [Matrix] 1 x 6
-3.75000  -2.45000  -1.15000  0.25000  1.95000  5.15000
Matrix example:
x = [9.3, 4.8; 10.6, 6.6; 11.9, 8.0; 13.3, 9.3; 15.0, 10.7; 18.2, 11.9];
c = center(x)
c = [Matrix] 6 x 2
-3.75000  -3.75000
-2.45000  -1.95000
-1.15000  -0.55000
 0.25000   0.75000
 1.95000   2.15000
 5.15000   3.35000

Comments

center(x) = x - mean(x)