Admin Production ni-theme
Current Publication

Scale1D

LabWindows/CVI

Scale1D

Advanced Analysis Library Only

AnalysisLibErrType Scale1D (double inputArray[], ssize_t numberOfElements, double outputArray[], double *offsetValue, double *scalingFactor);

Purpose

Scales the input array and returns the scale and offset constants. The scaled output array is in the range [–1:1]. Scale1D can obtain the ith element of the scaled array using the following formulas:



offset = min + scale

where max and min are the maximum and minimum values in the input array, respectively.

You can use LinEv1D to reconstruct the input array using the scale and offset constants. Scale1D can perform the operation in place; that is, the input and output arrays can be the same.

The following example uses the Scale1D function.

double inputData[10], scaledData[10];
double offset, scalingFactor;
AnalysisLibErrType status;

// Generate an array of random numbers
status = Uniform (10, 17, inputData);

status = Scale1D(inputData, 10, scaledData, &offset, &scalingFactor);

Parameters

Input
Name Type Description
inputArray double [] Input array used as the basis for the scaling operation.
numberOfElements ssize_t Number of elements used to perform the scaling operation.
Output
Name Type Description
outputArray double [] Scaled array.
offsetValue double Offsetting constant of the input array.
scalingFactor double Scaling constant of the input array.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later