NetworkFunctions
Advanced Analysis Library Only
AnalysisLibErrType NetworkFunctions (void *stimulusArray, void *responseArray, ssize_t samplesPerFrame, ssize_t numberOfFrames, double dt, double magnitudeSxy[], double phaseSxy[], double magnitudeHf[], double phaseHf[], double coherence[], double impulse[], double *df);
Purpose
Calculates the single-sided coherence function along with the averaged single-sided cross power spectrum, averaged single-sided frequency response, or transfer function, and impulse response, from a 2D array of stimulus signals and a 2D array of response signals. NetworkFunctions calculates the network functions as follows:
avg cross power = average(Sxy(f))

average impulse response = ReInvFFT(avg two-sided transfer function)

where | Sxy(f) is the two-sided cross power spectrum of x and y |
Sxx(f) is the two-sided auto power spectrum of x | |
Syy(f) is the two-sided auto power spectrum of y | |
x is the stimulus signal | |
y is the response signal |
stimulus is a 2D array that contains a time-domain signal, usually the network stimulus. response is a 2D array that contains a time-domain signal, usually the network response.
Each row in the stimulus array represents one frame of the network stimulus and is associated with one row of the response array, which represents one frame of the network response.
Parameters
Input | ||
Name | Type | Description |
stimulusArray | void * | Contains the time-domain signal, usually the network stimulus. The number of rows should equal numberOfFrames, and the number of columns should equal samplesPerFrame. The size of this array must be at least numberOfFrames × samplesPerFrame. |
responseArray | void * | Contains the time-domain signal, usually the network response. The number of rows should equal numberOfFrames, and the number of columns should equal samplesPerFrame. The size of this array must be at least numberOfFrames × samplesPerFrame. |
samplesPerFrame | ssize_t | Number of elements in one frame of the input stimulus and response arrays. |
numberOfFrames | ssize_t | Number of frames, or rows, the input stimulus and response arrays contain. Default Value: 1. |
dt | double | Sampling period of the time-domain signal, usually in seconds. dt = 1/fs, where fs is the sampling frequency of the time-domain signal. Default Value: 1. |
Output | ||
Name | Type | Description |
magnitudeSxy | double [] | Averaged single-sided cross power spectrum between the stimulus and response, in volts rms square if the input signals are in volts. If the input signals are not in volts, the results are in input signal units rms square. This array must be at least samplesPerFrame/2 elements long. The output is two arrays: magSxy (Vrms2) and phaseSxy (radians) |
phaseSxy | double [] | Averaged single-sided phase spectrum in radians showing the difference between the phases of the response signal and the stimulus signal. This array must be at least samplesPerFrame/2 elements long. |
magnitudeH_f | double [] | Magnitude of the averaged single-sided transfer function between the stimulus and response signals. This array must be at least samplesPerFrame/2 elements long. The output is two arrays: magtransfer (gain) and phasetransfer (radians) |
phaseH_f | double [] | Phase, in radians of the averaged single-sided transfer function between the stimulus and response signals. This array must be at least samplesPerFrame/2 elements long. |
coherence | double [] | Averaged single-sided coherence function spectrum. coherence is unitless and ranges from 0 (no coherence) to 1 (complete coherence). The coherence function shows the frequency content of the response as a result of the stimulus and measures the validity of the network frequency response measurement. This array must be at least samplesPerFrame/2 elements long. NetworkFunctions requires more than one set of data for both the stimulusArray and the responseArray to calculate the coherence function properly. If the input arrays contain only one reading, that is, one row of data each, the coherence function registers unity at all frequencies. |
impulse | double [] | The impulse response of the network based on time-domain signals stimulus and response. NetworkFunctions calculates the impulse from the averaged frequency response of the stimulus and response signals. The size of this array must be at least samplesPerFrame. |
df | double | Points to the frequency interval, in Hertz, if dt is in seconds. df = 1/(n × dt) |
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