Campbell Scientific CR9000X Measurement and Control System User Manual

Page 298

Advertising
background image

Section 8. Processing and Math Instructions

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

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

=

=

=

=

i

X

i

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

and

Y

are

the individual values of

X

and

Y

.

NANs are not included in the processing of the Spatial Covariance.

Parameter
& Data Type

Enter

COVSPA PARAMETERS

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.

The following example program takes 256 voltage measurements on 5
consecutive channels, and calculates the FFT for each of the 5 channels. It then
retrieves the FFT results for all 5 using the GetRecord instruction and performs
a Spatial Covariance on the first 4 channels against the last channel.

Dim Sig1(256)
Dim Sig2(256)
Dim Sig3(256)
Dim Sig4(256)
Dim Sig5(256)
Dim Sets(645)
Public CoVarVal(4)
DataTable(PSDFFT,True,-1)
FFT(Sig1(),IEEE4,256,20,uSec,4)

'Perform FFT on Sig1()

FFT(Sig2(),IEEE4,256,20,uSec,4)

'Perform FFT on Sig2()

FFT(Sig3(),IEEE4,256,20,uSec,4)

'Perform FFT on Sig3()

FFT(Sig4(),IEEE4,256,20,uSec,4)

'Perform FFT on Sig4()

FFT(Sig5(),IEEE4,256,20,uSec,4)

'Perform FFT on Sig5()

EndTable

8-12

Advertising