using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace XdCxRhDW.App { public class LinearInterpolation { public static double CalSigTimeDto(DateTime x, DateTime x0, DateTime x1, double y0, double y1) { // 线性插值公式: y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)) double y= y0 + (x - x0).TotalSeconds * ((y1 - y0) / (x1 - x0).TotalSeconds); if (y == double.NaN) { y = 0; } return y; } } }