Package PamUtils

Class PamInterp

java.lang.Object
PamUtils.PamInterp

public class PamInterp extends Object
Static classes to perform interpolation tasks

Original functions from:

Linear interpolation: http://www.java2s.com/Code/Java/Collections-Data-Structure/LinearInterpolation.htm

Author:
Jamie Macaulay
  • Constructor Details

    • PamInterp

      public PamInterp()
  • Method Details

    • interpLinear

      public static final double[] interpLinear(double[] x, double[] y, double[] xi) throws IllegalArgumentException
      Linear interpolation
      Parameters:
      x - - the original x value array
      y - - the original y value array
      xi - - new x values to find y for.
      Returns:
      Throws:
      IllegalArgumentException
    • interpLinear

      public static final BigDecimal[] interpLinear(BigDecimal[] x, BigDecimal[] y, BigDecimal[] xi)
      Linear interpolation
      Parameters:
      x - - the original x value array
      y - - the original y value array
      xi - - new x values to find y for.
      Returns:
      Throws:
      IllegalArgumentException
    • interpLinear

      public static final double[] interpLinear(long[] x, double[] y, long[] xi) throws IllegalArgumentException
      Linear interpolation
      Parameters:
      x - - the original x value array
      y - - the original y value array
      xi - - new x values to find y for.
      Returns:
      Throws:
      IllegalArgumentException
    • interpWaveform

      public static final double[] interpWaveform(double[] waveform, double ratio)
      Interpolate a waveform in the frequency domain in order to preserve frequency content and prevent introduction of high frequency artifacts.
      Parameters:
      waveform - - the waveform to interpolate.
      ratio - - the new waveform sample rate ration. For example to up sample from 192kHz to 288kHz then ratio=288/192.
      Returns:
      the interpolated waveform.