Spatial covariance – Campbell Scientific CR5000 Measurement and Control Module User Manual

Page 180

Advertising
background image

Section 8. Processing and Math Instructions

8-8

Public Volt1, Ans

'Declare variables.

BeginProg

Scan (1,Sec,3,0)
VoltDiff (Volt1,1,mV5000,1,True ,200,500,1.0,0) 'Return voltage on

DiffChan1

Ans = COSH( Volt1 )
NextScan

EndProg

Spatial Covariance

The CovSpa instruction computes the covariance(s) of sets of data that are

loaded into arrays.

Syntax

CovSpa(Dest, NumOfCov, SizeOfSets, CoreArray; DatArray)

CovSpa calculates the covariance(s) between the data in the CoreArray and
one or more data sets in the DatArray. The covariance of the sets of
data

X

and

Y

is calculated as:

2

1

1

1

)

,

(

n

Y

X

n

Y

X

Y

X

Cov

n

i

i

n

i

i

n

i

i

i

=

=

=

=

Where n is the number of values in each data set (SizeofSets).

i

X

and

i

Y

are

the individual values of

X

and

Y

.

Parameter
& Data Type

Enter

Dest

Variable or
Array

The Variable in which to store the results of the instruction. When multiple covariances are
calculated, the results are stored in an array with the variable name. An array must be
dimensioned to at least the value of NumOfCov.

NumOfCov
Constant

The number of covariances to be calculated. If four data sets are to be compared against a fifth
set, this would be set to four.

SizeOfSets
Constant

The number of values in the data sets for the covariance calculations.

CoreArray
Array

The array that holds the core data set. The covariance of core data with each of the other sets is
calculated independently. The data need to be consecutive in the array. If the first data value is
not the first point of the array, the first point of the data set must be specified in this parameter.

DatArray
Array

The array that contains the data set(s) for calculating the covariance with the CoreSet. When
multiple covariances are calculated, the data sets have to be loaded consecutively into one
array. The array must be dimensioned to at least the value of NumOfCov multiplied by
SizeOfSets. For example, if each set of data has 100 elements (SizeOfSets), and there are 4
covariances (NumOfCov) to be calculated, then the DatArray needs to be dimensioned to 4 x
100 = 400. If the first value of the first set is not the first point of the array, the first point of the
data set must be specified in this parameter.

Advertising