public class SavitzyGolayFilter extends Object
| Constructor and Description |
|---|
SavitzyGolayFilter(int left,
int right,
int order)
Prepares the filter coefficients
|
SavitzyGolayFilter(int left,
int right,
int order,
int derivative)
Prepares the filter coefficients
|
| Modifier and Type | Method and Description |
|---|---|
static double |
evaluatePolynomial(double[] poly,
double x)
Evaluates a polynomial where:
p(x) = poly[0] * x**m + poly[1] * x**(m-1) + ...
|
static double |
evaluatePolynomial(double[] poly,
double x,
int order)
Evaluates derivative of polynomial where with:
p(x) = poly[0] * x**m + poly[1] * x**(m-1) + ...
|
double |
filter(double[] o,
double[] mask,
int start,
int middle)
Calculates one point in the data, similar to one step of a
convolution.
|
float |
filter(float[] o,
double[] mask,
int start,
int middle)
Calculates one point in the data, similar to one step of a
convolution.
|
double[] |
filterData(double[] data)
filters the data by assuming the ends are reflected.
|
float[] |
filterData(float[] data)
filters the data by assuming the ends are reflected.
|
static double[][] |
getKernel(int size,
int order)
Creates a 2-d Kernel for using a savitzky-golay filter in 2-d.
|
static double |
pfact(int m,
int n)
Partial factorial,
|
double |
rFilter(double[] o,
double[] mask,
int start,
int middle)
Calculates one point in the data, similar to one step of a
convolution.
|
float |
rFilter(float[] o,
double[] mask,
int start,
int middle)
Calculates one point in the data, similar to one step of a
convolution.
|
static double[] |
SavitzkyGolayCoefficients(int nl,
int nr,
int order)
Creates the array of coefficients for using a least squares polynomial fit
of the data.
|
static double[] |
SavitzkyGolayCoefficients(int nl,
int nr,
int order,
int derivative)
Creates the array of coefficients for using a least squares polynomial fit
of the data.
|
public SavitzyGolayFilter(int left,
int right,
int order)
left - number of places to the left of the origionright - number of places to the right of the origionorder - of polynomial used to fit datapublic SavitzyGolayFilter(int left,
int right,
int order,
int derivative)
left - number of places to the left of the origionright - number of places to the right of the origionorder - of polynomial used to fit dataderivative - use a SavitzkyGolayFilter to calculate the derivative or order.public double[] filterData(double[] data)
data - the array that is going to be filtered.public float[] filterData(float[] data)
data - public float filter(float[] o,
double[] mask,
int start,
int middle)
o - - data that will be convolvedmask - - kernelstart - - position of the 'middle point' on the datamiddle - - postion of the center of the kernel on the kernelpublic double filter(double[] o,
double[] mask,
int start,
int middle)
o - - data that will be convolvedmask - - kernelstart - - position of the 'middle point' on the datamiddle - - postion of the center of the kernel on the kernelpublic double rFilter(double[] o,
double[] mask,
int start,
int middle)
o - - data that will be convolvedmask - - kernelstart - - position of the 'middle point' on the datamiddle - - postion of the center of the kernel on the kernelpublic float rFilter(float[] o,
double[] mask,
int start,
int middle)
o - - data that will be convolvedmask - - kernelstart - - position of the 'middle point' on the datamiddle - - postion of the center of the kernel on the kernelpublic static double[] SavitzkyGolayCoefficients(int nl,
int nr,
int order)
nl - - spaces to the leftnr - - spaces to the rightorder - - the order of the polynomial being used, not that nl+nr+1 must be more than the order of the polynomialpublic static double[] SavitzkyGolayCoefficients(int nl,
int nr,
int order,
int derivative)
nl - - spaces to the leftnr - - spaces to the rightorder - - the order of the polynomial being used, not that nl+nr+1 must be more than the order of the polynomialderivative - - returns a set of derivative coefficientspublic static double[][] getKernel(int size,
int order)
size - is the halfwidth of the kernel.order - is the order of polynomial being fit.public static double evaluatePolynomial(double[] poly,
double x)
poly - - double array representation of a polynomialx - - the variable that will be evaluated.public static double evaluatePolynomial(double[] poly,
double x,
int order)
poly - - double array representation of a polynomialx - - the variable that will be evaluated.order - - the order of the derivative. (n in description)public static double pfact(int m,
int n)
m - power of xn - number of derivativesCopyright © 2016. All rights reserved.