org.opensourcephysics.cabrillo.tracker
Class SecondDerivative

java.lang.Object
  extended by org.opensourcephysics.cabrillo.tracker.SecondDerivative
All Implemented Interfaces:
Derivative

public class SecondDerivative
extends java.lang.Object
implements Derivative

This implements an algorithm for finding a second derivative. Derivation of the 5-point algorithm: 1. Find least-square fit of parabola y = a + b*x + c*x^2. 2. Use eqn 3-86 from Parratt's Probability and Experimental Errors in Science (1961) to find best fit parameters. 3. Use n = 5 so the values of x are -2 thru +2 (units of delta_t), y are corresponding positions. 4. Plug in to obtain c = (2*x[i+2] - x[i+1] - 2*x[i] - x[i-1] + 2*x[i-2])/14. 5. Use derivative expressions y' = b + 2cx and y'' = 2c, and scale y'' by dt^2. 6. Final result is accel[i] = (2*x[i+2] - x[i+1] - 2*x[i] - x[i-1] + 2*x[i-2])/(7*dt^2). Other possible 5-point expressions (finite difference equations)--not used since more sensitive to noisy data(?): 1. accel[i] = (x[i+2] - 2*x[i] + x[i-2]) / (4*dt^2) 2. accel[i] = (-x[i+2] +16*x[i+1] - 30*x[i] +16*x[i-1] - x[i-2]) / (12*dt^2)

Author:
Douglas Brown

Constructor Summary
SecondDerivative()
           
 
Method Summary
 java.lang.Object[] evaluate(java.lang.Object[] data)
          Evaluates the derivative.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecondDerivative

public SecondDerivative()
Method Detail

evaluate

public java.lang.Object[] evaluate(java.lang.Object[] data)
Evaluates the derivative. Input data: data[0] = parameters (int[] {spill, start, stepsize, count}) data[1] = xData (double[]) data[2] = yData (double[]) data[3] = validData (boolean[]) Returned result: result[0] = null result[1] = null result[2] = xDeriv (double[]) (invalid values are NaN) result[3] = yDeriv (double[]) (invalid values are NaN)

Specified by:
evaluate in interface Derivative
Parameters:
data - the input data
Returns:
Object[] the result