lx
2025-08-07 9827a8864ba0df0a4e148b4a7ac3225df7b80728
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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;
        }
    }
}