|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.LinearSmoothing
public abstract class LinearSmoothing
Base class for linear digital smoothing. Linear in this sense means that it uses linear combination of the input values and output values. The most general formular for linear filtering runs as
yn=ΣMckxn+k+ΣNdjyn+j
Both summations starts at some (normally negative) index K,J, which means that in filtering, data from the 'past' and 'future' can be taken into account. The M+1 ck and the N dk coefficients are fixed and define the filter response. Finite impulse response filter have an N of zero, while N≠0 characterizes infinite (recursive) impulse response filters. Recursive filters normally have a superior performance to FIR filters, but can suffer the problem of instability. This makes them more prone to runaway behaviour for all-purpose filtering than FIR filters. Generally, use IIR filters, if you know precisely, which kind of signal you expect.
Literature:
Numerical Recipies for C, p 558ff.
| Nested Class Summary | |
|---|---|
private static class |
LinearSmoothing.Average
|
static class |
LinearSmoothing.File
Reads the specified column of a data file and does a moving-average filtering. |
| Field Summary | |
|---|---|
protected double[] |
cn
|
protected double[] |
dn
|
static int |
FIR
Used for nonrecursive filters. |
static int |
IIR
Used for recursive filters. |
protected int |
nj
|
protected int |
nk
|
protected int |
type
|
| Constructor Summary | |
|---|---|
protected |
LinearSmoothing()
|
| Method Summary | |
|---|---|
int |
getM()
Returns the number of coefficients used from the data side. |
int |
getN()
Returns the number of coefficients used from the smoothened data side. |
int |
getNj()
Returns the offset of smoothed data into the past. |
int |
getNk()
Returns the offset of data into the past. |
int |
getType()
Returns the type of this filter. |
boolean |
isValid()
Returns true, if smoothing can be done using this linear filter. |
static LinearSmoothing |
movingAverage(int window)
Creates a simple running average smoothing with the half-length of the given argument. |
protected abstract void |
setType()
Sets the type of this filter. |
double[] |
smoothAll(double[] input)
Smoothes an entire data set. |
double[] |
smoothAll(double[] input,
int start,
int end)
Smoothes an entire data set. |
double |
smoothAt(double[] input,
double[] output,
int ix,
int ox)
Smoothes one data point at the given indices. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FIR
public static final int IIR
protected int type
protected double[] cn
protected double[] dn
protected int nk
protected int nj
| Constructor Detail |
|---|
protected LinearSmoothing()
| Method Detail |
|---|
protected abstract void setType()
public int getType()
public boolean isValid()
cn
or dn is not equal null.
public int getNk()
public int getNj()
public int getM()
public int getN()
public double smoothAt(double[] input,
double[] output,
int ix,
int ox)
The input and output data arrays must be large enough to contain all relevant smoothing parameters. In particular that means that ix+Nk is non-negative, ix+Nk+cn.length is a valid index in input, ox+Nj is also non-negative, and that ox+Nj+dn.length is a valid index in output. Otherwise, an IllegalArgumentException is thrown.
input - The array of input pointoutput - The array of (already calculated) output points.ix - The index where to evaluate the input points.public double[] smoothAll(double[] input)
input - The input points
public double[] smoothAll(double[] input,
int start,
int end)
input - The input pointsstart - The index of the starting smooth.end - The index of the end element to smooth.
public static LinearSmoothing movingAverage(int window)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||