ptolemy.math
Class SignalProcessing.PolynomialSampleGenerator

java.lang.Object
  extended by ptolemy.math.SignalProcessing.PolynomialSampleGenerator
All Implemented Interfaces:
DoubleUnaryOperation
Enclosing class:
SignalProcessing

public static class SignalProcessing.PolynomialSampleGenerator
extends java.lang.Object
implements DoubleUnaryOperation

This class generates samples of a polynomial. The function computed is:

  h(t) = a0 + a1t + a2t2 + ...
         + an-1tn-1
  
or
  h(t) = a0 + a1t-1
         + a2t-2 + ...
         + an-1t-(n-1)
  
depending on the direction specified.


Field Summary
private  double[] _coefficients
           
private  int _coeffLength
           
private  int _direction
           
 
Constructor Summary
SignalProcessing.PolynomialSampleGenerator(double[] coefficients, int direction)
          Construct a PolynomialSampleGenerator.
 
Method Summary
 double operate(double time)
          Return a sample of the line, sampled at the specified time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_coefficients

private final double[] _coefficients

_coeffLength

private final int _coeffLength

_direction

private final int _direction
Constructor Detail

SignalProcessing.PolynomialSampleGenerator

public SignalProcessing.PolynomialSampleGenerator(double[] coefficients,
                                                  int direction)
Construct a PolynomialSampleGenerator. The input argument is an array of doubles a[0] = a0 .. a[n-1] = an-1 used to compute the formula : h(t) = a0 + a1t + ... + an-1tn-1 The array of doubles must be of length 1 or greater. The array of doubles is copied, so the user is free to modify it after construction. The exponents on t in the above equation will all be negated if the direction parameter is -1; otherwise the direction parameter should be 1.

Parameters:
coefficients - An array of double coefficients.
direction - 1 for positive exponents, -1 for negative exponents.
Method Detail

operate

public final double operate(double time)
Return a sample of the line, sampled at the specified time. Note that at time = 0, with a negative direction, the sample will be positive or negative infinity.

Specified by:
operate in interface DoubleUnaryOperation
Parameters:
time - The operand.
Returns:
The results of the operation.