Class AlgorithmLP

java.lang.Object
  extended by Algorithm
      extended by AlgorithmLP
All Implemented Interfaces:
java.lang.Runnable

public class AlgorithmLP
extends Algorithm


Constructor Summary
AlgorithmLP()
           
 
Method Summary
 double actual_error(java.util.Vector y_estimate, java.util.Vector iset)
          Compute the actual error from the given data points and the estimated values.
 void autocorrelate(java.util.Vector v, double[] autoCoeff_co)
          Actaully computes the autocorrelation coefficients
 void autoCorrelation()
          Computes the autocorrelation coeffient from the data sets
 double calculate_lpc(double[] auto_coeff, double[] lpc, double[] rc_reg)
          Actually calculate the LP coefficient and the Residual Error Energy, and Reflection Coefficients
 boolean checkdata_LP(java.util.Vector lp)
          Validates the class entered by user for Linear Prediction
 void display_result(double[] auto_coeff, double[] refCoef, double[] final_lpc, double est_err, double act_err, int index, int length)
          Display the results in the process box
 void estimate(java.util.Vector<MyPoint> iset, java.util.Vector<MyPoint> y_estimate, double avg, double[] final_lpc)
          Estimates the amplitude based on the LP coeficients.
 void final_estimate()
          Calculates the estimated points for the data inputs
 boolean initialize()
          Implements the initialize() method in the base class.
 void interpol(java.util.Vector<MyPoint> v, java.util.Vector<MyPoint> iset)
          Calculates the interpolated points for the data inputs
 void lpcCoefficient()
          Computes the Linear Prediction coefficient from the data sets
 double mean(java.util.Vector<MyPoint> v, java.util.Vector<MyPoint> mv)
          Calculates the mean and the zero-mean data points
 void run()
          Implementation of the run function from the Runnable interface.
 void spline(double[] x, double[] y, double[] y2, int size)
          Actually interpolates the points
 void splint(MyPoint u1, MyPoint u2, MyPoint r, double[] y2, int i)
          Interpolates for a point between the two known points using Cubic Interpolation
 void step2_display()
          Displays LP order, Error Energy and Reflection Coefficients
 
Methods inherited from class Algorithm
computeMeans, disableControl, enableControl, nextStep, prevStep, scaleToFitData, setDataPoints, setInputPanel, setOutputPanel, setProcessBox
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlgorithmLP

public AlgorithmLP()
Method Detail

initialize

public boolean initialize()
Implements the initialize() method in the base class. Initializes member data and prepares for execution of first step. This method "resets" the algorithm.

Specified by:
initialize in class Algorithm
Returns:
returns true if sets of data are valid

checkdata_LP

public boolean checkdata_LP(java.util.Vector lp)
Validates the class entered by user for Linear Prediction

Parameters:
lp -
Returns:
true if data is Vector lp is valid. It is invalid if the size of lp is 1 or any element is larger than the the previous element

run

public void run()
Implementation of the run function from the Runnable interface. Determines what the current step is and calls the appropriate method.

Specified by:
run in interface java.lang.Runnable
Specified by:
run in class Algorithm

interpol

public void interpol(java.util.Vector<MyPoint> v,
                     java.util.Vector<MyPoint> iset)
Calculates the interpolated points for the data inputs

Parameters:
v - input data points
iset - interpolated data points

spline

public void spline(double[] x,
                   double[] y,
                   double[] y2,
                   int size)
Actually interpolates the points

Parameters:
x - array containing the x coordinates of datapoints
y - array containing the y coordinates of datapoints
y2 - array containing the interpolated y coordinates
size - the size of the array to be interpolated

splint

public void splint(MyPoint u1,
                   MyPoint u2,
                   MyPoint r,
                   double[] y2,
                   int i)
Interpolates for a point between the two known points using Cubic Interpolation

Parameters:
u1 - start point for the interpolation
u2 - end point for the interpolation
r - returning point, basically the interpolated point
y2 - array used for reassigning of r
i - the sample number

mean

public double mean(java.util.Vector<MyPoint> v,
                   java.util.Vector<MyPoint> mv)
Calculates the mean and the zero-mean data points

Parameters:
v - orginal datapoints
mv - zero mean datapoints
Returns:
The average in a double

autoCorrelation

public void autoCorrelation()
Computes the autocorrelation coeffient from the data sets


autocorrelate

public void autocorrelate(java.util.Vector v,
                          double[] autoCoeff_co)
Actaully computes the autocorrelation coefficients

Parameters:
v - Vector of datapoints
autoCoeff_co - array of autocorrelation coefficients

lpcCoefficient

public void lpcCoefficient()
Computes the Linear Prediction coefficient from the data sets


calculate_lpc

public double calculate_lpc(double[] auto_coeff,
                            double[] lpc,
                            double[] rc_reg)
Actually calculate the LP coefficient and the Residual Error Energy, and Reflection Coefficients

Parameters:
auto_coeff - array of auto correlation coefficients
lpc - array of linear prediction coefficients
rc_reg - array of reflection coefficients
Returns:
residual error energy in a double

final_estimate

public void final_estimate()
Calculates the estimated points for the data inputs


estimate

public void estimate(java.util.Vector<MyPoint> iset,
                     java.util.Vector<MyPoint> y_estimate,
                     double avg,
                     double[] final_lpc)
Estimates the amplitude based on the LP coeficients.

Parameters:
iset - interpolated data points
y_estimate - predicted final signal data points
avg - mean of the original datapoints given
final_lpc - array of final linear prediction coefficients

actual_error

public double actual_error(java.util.Vector y_estimate,
                           java.util.Vector iset)
Compute the actual error from the given data points and the estimated values.

Parameters:
y_estimate - datapoints of the estimated datapoints
iset - original datapoints
Returns:
actual error energy in a double

step2_display

public void step2_display()
Displays LP order, Error Energy and Reflection Coefficients


display_result

public void display_result(double[] auto_coeff,
                           double[] refCoef,
                           double[] final_lpc,
                           double est_err,
                           double act_err,
                           int index,
                           int length)
Display the results in the process box

Parameters:
auto_coeff - Auto Correlation Coefficients
refCoef - Refelction Coefficient
final_lpc - Linear Prediction Coefficients
est_err - Estimated Error
act_err - Actual Error
length - Length of the data points