?? fitcurveleastsquares.cpp
字號:
//FitCurveLeastSquares.cpp
//最小二乘曲線擬合
#include <iostream> //模板類輸入輸出流標準頭文件
#include "FittingApproximation.h" //擬合與逼近頭文件
using namespace std; //名字空間
void main(void)
{
valarray<double> x(20), y(20), da(6), dt(3);
for(int i=0; i<20; i++)
{
x[i] = 0.1 * i;
y[i] = x[i] - exp(-x[i]);
}
cout.setf(ios::fixed); //輸出數據為定點法
cout.precision(14); //精度14位
FitCurveLeastSquares(x,y,da,dt);
for (i=0; i<6; i++)
cout << "da[" << i << "] = " << da[i] << endl;
cout << endl;
for (i=0; i<3; i++)
cout << "dt[" << i << "] = " << dt[i] << endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -