www.omatrix.com





:: O-Matrix ::
> Overview
> Examples
> Performance
> Analysis Functions
> Data Visualization
> The O-Matrix Language
> Data Manipulation/IO
> Application Development
> Using Matlab m-files




COLDSTD.OMS

Script File:
# Description:
# Computes the standard deviation of each column of a matrix.
#
# The j-th element of the standard deviation is equal to 
# sqrt( (x(1, j) - xbar(j))^2 + ... + x(n, j) - xbar(j))^2) 
# where ~n is the row dimension of ~x and ~xbar(j) is the
# average of the j-th column of ~x.
#
x = [ ...
	{0.,  2., 4.}, ... first column 
	{0., -1., 1.}  ... second column
]
print "x"
print x
print "colstd(x)"
print colstd(x)
#
# compute the standard deviation as per the formula above
delta = [x.col(1) - 2., x.col(2) - 0.]
sum = colsum(delta^2)
print "computed from formula in example"
print sqrt(sum / 2.) 
	  

Output:
x 
{
[ 0 , 0 ]
[ 2 , -1 ]
[ 4 , 1 ]
}

colstd(x) 
[ 2 , 1 ] 
computed from formula in example 
[ 2 , 1 ] 
	  


Company |  Products |  Showcase |  Support |  Ordering
Copyright© 1994-2009 Harmonic Software Inc. - All rights reserved.