Package PamUtils
Class PamInterp
java.lang.Object
PamUtils.PamInterp
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic final double[]
interpLinear
(double[] x, double[] y, double[] xi) Linear interpolationstatic final double[]
interpLinear
(long[] x, double[] y, long[] xi) Linear interpolationstatic final BigDecimal[]
interpLinear
(BigDecimal[] x, BigDecimal[] y, BigDecimal[] xi) Linear interpolationstatic 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.
-
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 arrayy
- - the original y value arrayxi
- - new x values to find y for.- Returns:
- Throws:
IllegalArgumentException
-
interpLinear
Linear interpolation- Parameters:
x
- - the original x value arrayy
- - the original y value arrayxi
- - 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 arrayy
- - the original y value arrayxi
- - 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.
-