几个拟合函数
本帖最后由 csharp 于 2015-2-28 19:53 编辑高斯消元法
**** Hidden Message *****
using System;
using 高斯消元法;
class Program
{
static void Main(string[] args)
{
/* double[,] xArray = new double[,]
{
{ 2.000000 ,-1.000000 , 3.000000,1.000000},
{ 4.000000 , 2.000000 , 5.000000,4.000000},
{ 1.000000 , 2.000000 , 0.000000 , 7.000000}
};*/
var sw = new System.Diagnostics.Stopwatch();
var y = new double[] { 29152.3, 47025.3, 86852.3, 132450.6, 200302.3, 284688.1, 396988.3 };
var x = new double[] { 1.24, 2.37, 5.12, 8.12, 12.19, 17.97, 24.99 };
// double[,] xArray;
sw.Start();
double[] ratio = FittingFunct.Linear(y, x);
sw.Stop();
foreach (double num in ratio)
{
Console.WriteLine(num);
}
Console.WriteLine("一次拟合计算时间:");
Console.WriteLine(sw.ElapsedMilliseconds);
sw.Start();
ratio = FittingFunct.Logest(y, x);
sw.Stop();
foreach (double num in ratio)
{
Console.WriteLine(num);
}
Console.WriteLine("对数拟合计算时间:");
Console.WriteLine(sw.ElapsedMilliseconds);
sw.Start();
ratio=FittingFunct.PowEst(y,x);
sw.Stop();
foreach (double num in ratio)
{
Console.WriteLine(num);
}
Console.WriteLine("指数函数拟合计算时间:");
Console.WriteLine(sw.ElapsedMilliseconds);
sw.Start();
ratio = FittingFunct.IndexEst(y, x);
sw.Stop();
foreach (double num in ratio)
{
Console.WriteLine(num);
}
Console.WriteLine("幂级数拟合计算时间:");
Console.WriteLine(sw.ElapsedMilliseconds);
Console.ReadKey();
}
}
}
9086.78858668264
15470.1622207392
一次拟合计算时间:
5
-50672.8309540339
114227.755345901
对数拟合计算时间:
5
22491.7341953499
0.873517197727303
指数函数拟合计算时间:
6
41540.5520468761
1.10858496140933
幂级数拟合计算时间:
7
回复看看............. Cal_Guass函数中是否应取第一列最大的一个值啊?
double max= guass;
89.
90. for (int i = j; i < count; i++)
91. {
92. if (Math.Abs(guass) > max)
93. {
94. max= guass;
95. k = i;
96. }
97. }
学习学习! 学习下,看看
回复看看............. 学几个拟合函数的写法 高升的DD,看看!
学无止境,啥也不说了,感谢楼主! 拟合都不知道是啥意思呀啊?赶紧百度一下{:1_12:} CAD二次开发交流群:709658679 学习了,楼主好样的 看看隐藏了什么 高斯消元? 感谢楼主分享
页:
[1]
2