using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ErrorAnalysis.Service { public class Utility { /// /// 单线性插值法 /// /// 插值 /// 起始值 /// 起始值对应值 /// 结束值 /// 结束值对应值 /// 插值对应结果 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; } public static (double, double) InterpolateBySw(double c, double o, double sw) { var cRes = (100 - sw) / 100 * c; var oRes = sw / 100 * o; return (cRes, oRes); } } }