ZeroPhaseFiltering
Advanced Analysis Library Only
AnalysisLibErrType ZeroPhaseFiltering (double xArray[], ssize_t numberOfXAndYElements, double reverseCoefficients[], int numberOfReverseCoeffs, double forwardCoefficients[], int numberOfForwardCoeffs, double yArray[]);
Purpose
Filters the input sequence using a zero-phase filter.
Filters the input sequence xArray as shown in the following illustration:
g-n is the reverted sequence of gn. H(z) is an IIR filter whose coefficients are specified by reverseCoefficients and forwardCoefficients.
With a zero phase filter, the output sequence yArray has no phase distortion. Although the zero phase filter is non-causal, it is useful in offline applications such as filtering a sound file saved on disk.
Example Code
double x[100], y[100];
double a[3] = {1, -1.14298, 0.412802};
double b[3] = {0.0674553, 0.134911, 0.0674553};
int n = 100, na = 3, nb = 3;
double noise[100], phase=0.0;
int i;
SineWave(n, 5.0, 0.05, &phase, x);
WhiteNoise(n, 1.0, 1, noise);
for(i = 0; i < n; i++)
x[i] += noise[i];
ZeroPhaseFiltering(x, n, a, na, b, nb, y);
Parameters
| Input | ||
| Name | Type | Description |
| xArray | double [] | The input signal. |
| numberOfXAndYElements | ssize_t | The length of the input signal. |
| reverseCoefficients | double [] | The reverse coefficients of the filter. |
| numberOfReverseCoeffs | int | The length of the reverse coefficient array reverseCoefficients. |
| forwardCoefficients | double [] | The forward coefficients of the filter. |
| numberOfForwardCoeffs | int | The length of the forward coefficient array forwardCoefficients. |
| Output | ||
| Name | Type | Description |
| yArray | double [] | The output signal. The length of yArray must be at least numberOfXAndYElements. |
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 2010 and later