Class DigitalSignalProcessor
Convenience class for packaging common digital processing operations. This
class relies heavily upon most of the other classes on the
xal.tools.dsp
package.
Rather than making this a utility class, it has been designed to be instantiated. In this manner it can be tuned by the users. Although this capability is not available now, this class may evolve.
- Author:
- Christopher K. Allen
-
Constructor Summary
ConstructorsConstructorDescriptionDigitalSignalProcessor
(int szSignal) Create a newDigitalSignalProcessor
object for processing signals of length szSignal. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
autoCorrelation
(double[] arrSignal) Compute and return the auto-correlation function for the given discrete signal.double[]
average
(double[] arrSignal) Compute and return the (running) average of the given signal.double[]
crossCorrelation
(double[] arrStat, double[] arrShft) Compute and return the cross-correlation function for the given signals.double[]
differentiate
(double[] arrSignal) Compute and return the differential of the given signal.int
Return the signal size that this instance can process.double[]
integrate
(double[] arrSignal) Compute and return the integral of the given signal (zero constant of integration).double[]
powerSpectrum
(double[] arrSignal) Compute and return the power spectrum of the given signal.double[]
signalIndicator
(double[] arrSignal) Compute and return the signal presence indicator function for the given signal.double[]
totalVariation
(double[] arrSignal) Compute and return the total variation of the given signal.
-
Constructor Details
-
DigitalSignalProcessor
public DigitalSignalProcessor(int szSignal) Create a newDigitalSignalProcessor
object for processing signals of length szSignal.- Parameters:
szSignal
- size of signal to be processed
-
-
Method Details
-
getSignalSize
public int getSignalSize()Return the signal size that this instance can process.- Returns:
- digital signal size expected for processing
-
differentiate
Compute and return the differential of the given signal.- Parameters:
arrSignal
- signal to differentiate- Returns:
- differentiated signal
- Throws:
IllegalArgumentException
- this should not occur (serious internal error)
-
integrate
Compute and return the integral of the given signal (zero constant of integration).- Parameters:
arrSignal
- signal to integrate- Returns:
- integrated signal
- Throws:
IllegalArgumentException
- this should not occur (serious internal error)
-
average
Compute and return the (running) average of the given signal.- Parameters:
arrSignal
- signal to average- Returns:
- averaged signal
- Throws:
IllegalArgumentException
- this should not occur (serious internal error)
-
totalVariation
public double[] totalVariation(double[] arrSignal) Compute and return the total variation of the given signal. The total variation TV(f) of a signal f(·) is defined as
TV[f](t) ≡ ∫t|df(τ)/dt|dτ- Parameters:
arrSignal
- target signal- Returns:
- total variation of the argument
-
signalIndicator
Compute and return the signal presence indicator function for the given signal. The indicator function is computed by subtracting the (running) average from the signal then computing the total variation. In this manner we hope to observe variation over the noise floor.
The returned function is normalized so that its maximum value is unity. It has the form of a cumulative distribution function so that increasing value is indicative of signal likelihood.
- Parameters:
arrSignal
- target signal- Returns:
- signal presence indicator function
- Throws:
IllegalArgumentException
- this should not occur (serious internal error)- See Also:
-
autoCorrelation
Compute and return the auto-correlation function for the given discrete signal.
In the spirit of the Z transform we assume that the function is periodic so that f[n + N] = f[n]. In this manner the auto-correlation Rxx[k] function is also periodic, specifically, Rxx[-k] = Rxx[N - k].
Assuming periodicity gives us the follow fact: it's value will never fall to zero if the data contains a noise process with non-zero mean. Indeed, by the property of the auto-correlation Rxx[-k] = Rxx[k] and, therefore, Rxx[k] = Rxx[N - k] by periodicity. If the underlying signal has support small enough the minimum value of the auto-correlation (at k = N/2) will depend only upon the noise process. If we assumed the original data non-periodic, this condition would not occur.
- Parameters:
arrSignal
- function to auto-correlate- Returns:
- (one-sided) auto-correction function
- Throws:
IllegalArgumentException
- this should not occur (serious internal error)
-
crossCorrelation
public double[] crossCorrelation(double[] arrStat, double[] arrShft) throws IllegalArgumentException Compute and return the cross-correlation function for the given signals. Note that the second argument is the signal that is shifted in the calculation.
In the spirit of the Z transform we assume that each function is periodic so that f[n + N] = f[n]. In this manner the cross-correlation Rxy[k] function is also periodic. More importantly, it's value will never fall to zero if the data contains a noise process with non-zero mean. If the underlying signal has support small enough the minimum value of the cross-correlation will depend only upon the noise process. If we assumed the original function non-periodic, this condition would not occur.
- Parameters:
arrStat
- stationary functionarrShft
- shifted function- Returns:
- (one-sided) cross-correction function
- Throws:
IllegalArgumentException
- the arguments are of different sizes
-
powerSpectrum
Compute and return the power spectrum of the given signal. The spectral components are returned in the usual DFT arrangement. Namely, the first N/2 components are the positive frequency components with zero frequency first in ascending order. The next N/2 components are the negative components with the highest negative frequency (-N/2) first then in descending order. This arrangement is due to the topology of the unit circle in the complex plane.- Parameters:
arrSignal
- signal to analyze- Returns:
- frequency spectrum of given signal
- Throws:
IllegalArgumentException
- this should not occur (serious internal error)- See Also:
-