Modifier and Type | Method | Description |
---|---|---|
int |
extraN() |
|
float[] |
outIn(float[] sig,
int nzero) |
|
void |
setConsoleOut(long consoleH) |
|
void |
setMs(double sample_ms) |
|
void |
setParams(double[] params) |
|
void |
setSystemOut(boolean use_System_out) |
void setParams(double[] params)
params
- is an array of double-precision floating-point values
configuring the filter. These values of type double have sufficient
precision to pass integer values as required. Implementation of this
method typically checks the length of the params array: if params.length
is less than the required number of parameters, default values are used.void setMs(double sample_ms)
sample_ms
- is the time interval between input samples to the filter,
expressed in milliseconds (ms).
Invoking this method computes filter coefficients from the parameters specified in a prior call to setParams(). This action prepares the filter for processing a sequence of input samples supplied to outIn() below.
Reinvoking setMs() not only recalculates the filter coefficients, which is needed if another call is made to setParams. It also reinitializes any buffers holding samples in the "memory" of the filter.
int extraN()
To output nBuf samples of from the filter, for example, nBuf + extraN() samples of input are required. For a non-causal filter that needs to look ahead to input x[n+M] to compute output y[n], extraN() == M immediately after setMs() is called to initialize the filter.
float[] outIn(float[] sig, int nzero)
sig
- is the array of input samples.nzero
- extends the input with zero-valued samples. This "padding"
is useful if sig contains a pulse waveform and you want to compute the
"tail" of the filter response past the end of that pulse.You can call outIn(sig, 0) repeatedly and the filter will keep track of the state of the filter between successive calls. A call to setMs() resets the state of the filter to the initial condition, typically that where the input to the filter has been zero until supplying the next values in sig as input.
If you want to apply a non-causal filter with M-sample look ahead to an array sig in one step, and if you want sig.length samples of output to match the sig.length samples of input, invoke
float[] out = mySISOFilter.inOut(sig, mySISOFilter.extraN());
to properly extend input sig with extraN() zeroes to obtain the required number of output samples.
void setConsoleOut(long consoleH)
consoleH
- is a native-code "handle" for tracing/loggingvoid setSystemOut(boolean use_System_out)
of
- true enables tracing/logging to System.out
Use to view output in the Matlab Command Window