|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdriver.ted.utilities.T_Interpolate
public class T_Interpolate
Title: T_Interpolate
Description: This class provides interpolation functions used within T_Algorithms.
These algorithms are based upon Jean Meeus' Astronomical Algorithms book, Chapter 3,
pages 23-34.
Copyright: (c) 2001 - 2006
Change History:
| Constructor Summary | |
|---|---|
T_Interpolate()
Constructor initializes all values to zero (0) , and INTERPOLATION_DEFINED to false. |
|
| Method Summary | |
|---|---|
void |
defineInterpolation(T_Vector X,
T_Vector Y)
Sets the X and Y values to interpolate over. |
double |
get_n()
Provides the interpolating factor, n. |
double |
get_nmax()
Provides the maximum interpolating factor, n_max. |
double |
getFirstDiffA()
Returns the first difference (A) equal to y2 - y1 |
double |
getFirstDiffB()
Returns the first difference (B) equal to y3 - y2 |
double |
getMaxPercentDiff()
The getMaxPercentDiff method. |
double |
getSecondDiffC()
Returns the second difference (C) equal to B - A (y1 + y3 - 2*y2) |
double |
getYmax()
Provides the maximum Y value defined from the three or 5 input Y values. |
double |
interpolate(double x)
The interpolation method. |
double |
interpolate(double x,
double N)
The interpolation method. |
static void |
main(java.lang.String[] args)
An executable program used to test the interpolation algorithm. |
java.lang.String |
toString()
Provides statistics for the current Interpolation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public T_Interpolate()
INTERPOLATION_DEFINED to false.
| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Object
public void defineInterpolation(T_Vector X,
T_Vector Y)
INTERPOLATION_DEFINED flag to true.
X - The array of X values to interpolate between.
Must be either 3 or 5 in length.Y - The array of Y values to interpolate over.
Must be either 3 or 5 in length.public double get_n()
public double getYmax()
public double get_nmax()
public double interpolate(double x)
defineInterpolation above. The interpolating
factor n will be calculated as n = (x-xMid)/interval where
xMid is the middle value of the X values passed into the
defineInterpolation method above and
interval is the difference between successive X values in the X
array passed into the defineInterpolation method above.
x - An double value between the X values defined in the X array supplied in
defineInterpolation
public double interpolate(double x,
double N)
defineInterpolation above and a predefined
interpolating factor N.
x - An double value between the X values defined in the X array supplied in
defineInterpolationN - The predefined interpolating factor.
public double getMaxPercentDiff()
public double getFirstDiffA()
public double getFirstDiffB()
public double getSecondDiffC()
public static void main(java.lang.String[] args)
T_Interpolate I = new T_Interpolate();
T_Vector X = new T_Vector(3);
T_Vector Y = new T_Vector(3);
date.setJulianDate(11,7,1992,0,0,0);
X.setElement(0,date.getJulianDate());
Y.setElement(0,0.884226);
date.setJulianDate(11,8,1992,0,0,0);
X.setElement(1,date.getJulianDate());
Y.setElement(1,0.877366);
date.setJulianDate(11,9,1992,0,0,0);
X.setElement(2,date.getJulianDate());
Y.setElement(2,0.870531);
I.defineInterpolation(X,Y);
// Be Sure the units you are interpolating between are the same
date.setJulianDate(11,8,1992,4,21,0);
System.out.println("Interpolation at 4:21 on the 8th is: ");
System.out.println(I.interpolate(date.getJulianDate()));
System.out.println(I.toString());
System.exit(0);
Output:
Interpolation at 4:21 on the 8th is: 0.8761253012701685 Statistics of current interpolation: Percent Difference = 0.0028273314740861226% Differences: A = -0.006859999999999977 C = 2.5000000000052758E-5 B = -0.0068349999999999245
args - String parameter, not used in this test application.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||