小编man*_*421的帖子

从数据点计算指数增长方程c#

我正在尝试使用 C# 应用程序分析一些数据,并且需要计算趋势线。我知道趋势线有多种类型,但现在我正在尝试计算指数增长;我将用它来预测未来的价值。我一直在研究的方程是

x(t) = x(0) * ((1+r)^t)
Run Code Online (Sandbox Code Playgroud)

这是我为尝试复制该图而编写的代码:

public void ExponentialBestFit(List<DateTime> xvalues, List<double> yvalues)

        {
            //Find the first value of y (The start value) and the first value of x (The start date)
            xzero = Convert.ToDouble(xvalues[0].ToOADate());
            yzero = yvalues[0];
            if (yzero == 0)
                yzero += 0.1;

            //For every value of x (exluding the 1st value) find the r value
            //
            //                       |   y   |          Where t = the time sinse the start time (time period)
            //Equation for r = …
Run Code Online (Sandbox Code Playgroud)

c# math visual-studio-2010 exponential

5
推荐指数
2
解决办法
4444
查看次数

标签 统计

c# ×1

exponential ×1

math ×1

visual-studio-2010 ×1