Shift

Advanced Analysis Library Only

AnalysisLibErrType Shift (double inputArray[], int numberOfElements, int numShifts, double outputArray[]);

Purpose

Shifts the elements of the input array a specified number of places using the following formula:

yi = xi – shifts

You can specify the number of shifts to be in the positive (right) or negative (left) direction.

Example

/* Generate an array with random numbers and shift it by 20 samples. */
double x[200], y[200];
int n;
int shifts;
n = 200;
shifts = 20;
Uniform (n, 17, x);
Shift (x, n, shifts, y);

Parameters

Input
Name Type Description
inputArray double-precision array Input array to shift.
numberOfElements integer Number of elements in the input array.
numShifts integer Number of shifts performed on the input array..

If numShifts is positive, the shift is to the right. If numShifts is negative, the shift is to the left. This is not a circular shift. Shift does not retain the shifted values and replaces the trailing portion of the shift with zero.
Output
Name Type Description
outputArray double-precision array Shifted 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.