using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace ErrorAnalysis.Service
|
{
|
public class Utility
|
{
|
/// <summary>
|
/// 单线性插值法
|
/// </summary>
|
/// <param name="value">插值</param>
|
/// <param name="x0">起始值</param>
|
/// <param name="y0">起始值对应值</param>
|
/// <param name="x1">结束值</param>
|
/// <param name="y1">结束值对应值</param>
|
/// <returns>插值对应结果</returns>
|
public static double Interpolate(double value, double x0, double y0, double x1, double y1)
|
{
|
// Calculate the interpolated value using linear interpolation formula
|
double y = y0 + (value - x0) * (y1 - y0) / (x1 - x0);
|
return y;
|
}
|
}
|
}
|