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