|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.oregondsp.signalProcessing.filter.iir.Polynomial
public class Polynomial
Class to implement polynomial functions
This class represents polynomials by their coefficients, stored in a double array, with the lowest coefficient (constant) stored at the 0 location. Consequently the polynomial is of the form:
A(x) = a[0] + a[1]*x + a[2]*x2 + ... + a[N]*xN
The class implements basic polynomial arithmetic and other functions useful in designing analog and digital filters. An example of the latter includes the calculation of reflection coefficients for use in allpass filters.
Constructor Summary | |
---|---|
Polynomial(double c)
Instantiates a new constant polynomial. |
|
Polynomial(double[] a)
Instantiates a new polynomial from a double array containing the coefficients. |
|
Polynomial(int order)
Instantiates a new zero polynomial. |
|
Polynomial(Polynomial B)
Instantiates (copies) a new polynomial from an existing Polynomial instance. |
Method Summary | |
---|---|
double[] |
coefficients()
Returns the polynomial coefficients. |
Polynomial |
derivative()
Computes the derivative of a polynomial. |
double |
discreteTimeGroupDelay(double Omega)
Evaluates the group delay of a discrete time filter transfer function specified by this polynomial. |
Complex |
evaluate(Complex c)
Evaluates this polynomial for a complex argument. |
double |
evaluate(double x)
Evaluates this polynomial for a real argument. |
double |
groupDelay(double omega)
Evaluates the group delay of an analog filter transfer function specified by this polynomial. |
Polynomial |
minus(double c)
Returns a new Polynomial containing the difference between this polynomial and a constant. |
Polynomial |
minus(Polynomial B)
Subtracts a polynomial from this polynomial. |
void |
minusEquals(double c)
Subtracts a constant from this polynomial. |
void |
minusEquals(Polynomial B)
Subtracts a polynomial from this polynomial. |
int |
order()
Returns the order (degree) of the polynomal. |
Polynomial |
over(double c)
Divides this polynomial by a constant and returns the result of division in a new Polynomial object. |
Rational |
over(Polynomial B)
Divides this polynomial by another polynomial. |
void |
overEquals(double c)
Divides this polynomial by a constant. |
Polynomial |
plus(double c)
Returns a new Polynomial object containing the sum polynomial of this and a constant. |
Polynomial |
plus(Polynomial B)
Returns a new Polynomial object containing the sum of this and the argument polynomial. |
void |
plusEquals(double c)
Adds a constant to this polynomial. |
void |
plusEquals(Polynomial B)
Adds a polynomial to this polynomial. |
void |
print(java.io.PrintStream ps)
Prints the coefficients of this polynomial to a PrintStream. |
double[] |
reflectionCoefficients()
Computes reflection coefficients for this polynomial. |
Polynomial |
times(double c)
Computes the product of a constant and this polynomial. |
Polynomial |
times(Polynomial B)
Computes the product of this polynomial with another polynomial. |
void |
timesEquals(double c)
Multiplies (scales) this polynomial by a constant. |
void |
timesEquals(Polynomial B)
Multiplies this by a Polynomial factor. |
void |
trim()
Removes leading zero coefficients in a polynomial. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Polynomial(double[] a)
a
- double[] containing the polynomial coefficients.public Polynomial(Polynomial B)
B
- Polynomial to be copied into the new Instance.public Polynomial(int order)
order
- int containing the order (degree) of the polynomial.public Polynomial(double c)
c
- double containing the constant.Method Detail |
---|
public void trim()
public int order()
public double[] coefficients()
public Polynomial plus(double c)
c
- double constant to be added to this polynomial.
public void plusEquals(double c)
c
- double constant to be added to this polynomial.public Polynomial plus(Polynomial B)
B
- Polynomial to be added to this polynomial.
public void plusEquals(Polynomial B)
B
- Polynomial object containing the polynomial to be added to this polynomial.public Polynomial minus(double c)
c
- double containing the constant to be subtracted from this polynomial.
public void minusEquals(double c)
c
- double constant to be subtracted from this polynomial.public Polynomial minus(Polynomial B)
B
- Polynomial to be subtracted from this Polynomial.
public void minusEquals(Polynomial B)
B
- Polynomial to be subtracted from this polynomial.public Polynomial times(double c)
c
- The double constant factor multiplying this polynomial.
public void timesEquals(double c)
c
- The constant multiplicative factor.public Polynomial times(Polynomial B)
B
- Polynomial object containing the multiplicative factor.
public void timesEquals(Polynomial B)
B
- Polynomial object containing the multiplicative factor.public Polynomial over(double c)
c
- The double divisor.
public void overEquals(double c)
c
- The double divisor.public Rational over(Polynomial B)
B
- The Polynomial divisor.
public Polynomial derivative()
public double evaluate(double x)
x
- double containing the argument of the polynomial.
public Complex evaluate(Complex c)
c
- Complex object containing the argument of the polynomial.
public double groupDelay(double omega)
omega
- double specifying the radial frequency (2*pi*f) at which the group delay is evaluated.
public double discreteTimeGroupDelay(double Omega)
Omega
- double specifying the value discrete-time frequency [0 pi] at which the group delay is evaluated.
public double[] reflectionCoefficients()
public void print(java.io.PrintStream ps)
ps
- PrintStream object to which this polynomial's coefficients are printed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |