本文整理汇总了Java中org.apache.commons.math3.analysis.interpolation.LinearInterpolator.interpolate方法的典型用法代码示例。如果您正苦于以下问题:Java LinearInterpolator.interpolate方法的具体用法?Java LinearInterpolator.interpolate怎么用?Java LinearInterpolator.interpolate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.analysis.interpolation.LinearInterpolator
的用法示例。
在下文中一共展示了LinearInterpolator.interpolate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: smooth
import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入方法依赖的package包/类
@Override
public double[] smooth(double[] sourceX, double[] noisyY, double[] estimateX, double parameter) {
if(sourceX.length < 2)
{
return new double[sourceX.length];
}
LinearInterpolator interpolator = new LinearInterpolator();
PolynomialSplineFunction estimateFunc = interpolator.interpolate(sourceX, noisyY);
double[] result = new double[estimateX.length];
for(int i =0; i < estimateX.length;i++)
{
if(estimateFunc.isValidPoint(estimateX[i]))
{
result[i] = estimateFunc.value(estimateX[i]);
}
else
{
result[i] = Double.NaN;
}
}
return result ;
}
示例2: linearInterpFunc
import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入方法依赖的package包/类
/**
* Make linear interpolation function - PolynomialSplineFunction
* @param x X data
* @param y Y data
* @return Linear interpolation function
*/
public static PolynomialSplineFunction linearInterpFunc(Array x, Array y) {
double[] xd = (double[]) ArrayUtil.copyToNDJavaArray(x);
double[] yd = (double[]) ArrayUtil.copyToNDJavaArray(y);
LinearInterpolator li = new LinearInterpolator();
PolynomialSplineFunction psf = li.interpolate(xd, yd);
return psf;
}
示例3: UpdateDialogListener
import org.apache.commons.math3.analysis.interpolation.LinearInterpolator; //导入方法依赖的package包/类
UpdateDialogListener(double[] cx, double[] cy, double maxY, int centre, double scale, PlotWindow pw,
Label label)
{
offset = (int) cx[0];
this.cy = cy;
// Interpolate missing values
int upper = cx.length - 1;
if (cx[upper] - cx[0] != upper)
{
LinearInterpolator in = new LinearInterpolator();
PolynomialSplineFunction f = in.interpolate(cx, cy);
cx = SimpleArrayUtils.newArray(upper + 1, cx[0], 1.0);
cy = new double[cx.length];
for (int i = 0; i < cx.length; i++)
cy[i] = f.value(cx[i]);
}
this.maxY = maxY;
this.centre = centre;
this.scale = scale;
this.pw = pw;
this.label = label;
drawing = Utils.isShowGenericDialog();
if (drawing)
update();
}