Admin Production ni-theme
Current Publication

PeriodNoise

LabWindows/CVI

PeriodNoise

Advanced Analysis Library Only

AnalysisLibErrType PeriodNoise (ssize_t numberOfElements, double amplitude, int seed, double periodicNoise[]);

Purpose

Generates an array containing periodic pseudorandom noise.

The output array contains all frequencies that can be represented with an integral number of cycles in the requested numberOfElements. Each frequency-domain component has a magnitude of amplitude and random phase.

Another way of thinking of the output array of this function is that it is a summation of sinusoidal signals with the same amplitudes but with random phases. The unit of amplitude is the same as the output periodicNoise and is a linear measure of amplitude, similar to other signal generation functions.

PeriodNoise generates the same periodic random sequence for a given positive seed value. PeriodNoise does not reseed the random phase generator if seed is negative.

The output periodic random noise is bounded by the following values:

amplitude * (numberOfElements/2 - 1) if numberOfElements is even;

amplitude * (numberOfElements - 1) / 2 if numberOfElements is odd.

You can use periodic random noise to compute the frequency response of a linear system in one time record instead of averaging the frequency response over several time records, as you must for nonperiodic random noise sources.

You do not need to window periodic random noise before performing spectral analysis because periodic random noise is self-windowing and therefore has no spectral leakage. This is because periodic random noise contains only integral-cycle sinusoids.

Example Code

/* The following code generates an array of periodic random numbers. */
double x[20], amp;
int n;
n = 20;
amp = 1.0;
PeriodNoise (n, amp, 17, x);

Parameters

Input
Name Type Description
numberOfElements ssize_t The number of elements to generate in the periodic random noise pattern.
amplitude double The maximum frequency domain amplitude over which the periodic random noise pattern is distributed.

Default Value: 1.0.
seed int The seed value used to generate the random number.

When seed ≥ 0, PeriodNoise generates a new random sequence using the seed value you specify. When seed < 0, the previously generated random sequence continues.
Output
Name Type Description
periodicNoise double [] The output array containing the generated periodic random noise pattern.

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 2012 and later