资源简介

用C++实现数据探测法检验粗差,可通过txt文件输入系数矩阵,权阵,观测值向量。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

资源截图

代码片段和文件信息

// Approach1.cpp : 此文件包含 “main“ 函数。程序执行将在此处开始并结束。
//


#include   

using namespace std;


int main()
{
//变量定义
int n t a;
double u_ = 1.96;
double c0;
double umax;

cout << “=====数值探测法检验粗差=====“ << endl;
cout << “========基于间接平差========“ << endl;
cout << “====输入矩阵时请按行输入====“ << endl;
cout << “===汇报人:姚树一、葛志金===“ << endl;
cout << “检验量:u0.025=1.96“ << endl;
cout << “请输入:“ << endl;
//输入t、n
cout << “观测值数量n=“;
cin >> n;
cout << “独立参数数量t=“;
cin >> t;
cout << endl;
cout << “输入完成。观测值数量n=“ << n << “,独立参数数量t=“ << t << endl;
cout << endl;


Matrix B = Matrix(n t);
Matrix BT = Matrix(t n);
Matrix P_input = Matrix(n 1);
Matrix P = Matrix(n n);
Matrix L = Matrix(n 1);
Matrix d = Matrix(n 1);
Matrix X0 = Matrix(t 1);
Matrix l = Matrix(n 1);
Matrix BX0 = Matrix(n 1);
Matrix L_BX0 = Matrix(n 1);
Matrix Nbb = Matrix(t t);
Matrix invNbb = Matrix(t t);
Matrix Qvv = Matrix(n n);
Matrix Q = Matrix(n n);
Matrix eye = Matrix(n n);
Matrix BinvNbb = Matrix(n t);
Matrix BinvNbbBT = Matrix(n n);
Matrix x = Matrix(t 1);
Matrix invNbbBT = Matrix(t n);
Matrix invNbbBTP = Matrix(t n);
Matrix V = Matrix(n 1);
Matrix vtpv = Matrix(1 1);
Matrix vtp = Matrix(1 n);
Matrix u = Matrix(n 1);
Matrix diag_Qvv = Matrix(n 1);
Matrix sqrt_diag_Qvv = Matrix(n 1);
Matrix uc0 = Matrix(n 1);
Matrix ru = Matrix(n 1);
Matrix find_error = Matrix(1 2);
Matrix L_ = Matrix(n 1);






//输入B
input(B “请输入B矩阵“ “B.txt“);
BT = B.T();
//输入P
input(P_input “请输入P矩阵“ “P.txt“);
P = diag2m(P_input);
cout << P << endl;
//输入L
input(L “请输入L向量“ “L.txt“);
//输入d
input(d “请输入d向量“ “d.txt“);
//输入X0
input(X0 “请输入X0向量“ “X0.txt“);
//计算l
BX0 = B * X0;
//cout << “BX0=“ << endl;
//cout << BX0 << endl;
L_BX0 = L-BX0;
//cout << “L_BX0=“ << endl;
//cout << L_BX0 << endl;
l = (L_BX0 - d)*1000;
cout << “l=(mm)“ << endl;
cout << l << endl;
//计算Nbb、Qxx
Nbb = (BT*P)*B;
cout << “Nbb=“ << endl;
cout << Nbb << endl;
cout << “Qxx=“ << endl;
invNbb = Nbb.inverse();
cout << invNbb << endl;
//计算Qvv
eye = eye.eye();
Q = inv_diag(P);
//cout << “Q=“ << endl;
//cout << Q << endl;
BinvNbb = B * invNbb;
//cout << “BinvNbb=“ << endl;
//cout << BinvNbb << endl;
BinvNbbBT = BinvNbb * BT;
//cout << “BinvNbbBT=“ << endl;
//cout << BinvNbbBT << endl;
Qvv = Q- BinvNbbBT;
//cout << “Qvv=“ << endl;
//cout << Qvv << endl;
//求x
invNbbBT = invNbb * BT;
invNbbBTP = invNbbBT * P;
x = invNbbBTP * l;
cout << “x=(mm)“ << endl;
cout << x << endl;
//求V
V = B * x - l;
cout << “V=(mm)“ << endl;
cout << V << endl;
vtp = V.T()*P;
vtpv = vtp*V;
//求单位权中误差
c0 = sqrt(vtpv.det() / (n - t));
cout << “单位权中误差(mm):“ << c0 << endl;
//求检测量u
diag_Qvv=ext_diag(Qvv);
//cout << “diag_Qvv=“ << endl;
//cout << diag_Qvv << endl;
sqrt_diag_Qvv = Msqrt(diag_Qvv);
//cout << “sqrt_diag_Qvv=“ << endl;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件     167424  2019-03-19 20:18  approach1程序\Approach1.exe

     文件        115  2019-03-19 15:27  approach1程序\B.txt

     文件         85  2019-03-19 15:30  approach1程序\d.txt

     文件        100  2019-03-19 15:31  approach1程序\L.txt

     文件         60  2019-03-19 15:49  approach1程序\P.txt

     文件        151  2019-03-22 11:32  approach1程序\V.txt

     文件         54  2019-03-22 11:32  approach1程序\x.txt

     文件         31  2019-03-19 15:56  approach1程序\X0.txt

     文件        152  2019-03-22 11:32  approach1程序\改正后L.txt

     文件     877583  2019-03-13 16:50  approach1程序\数据探测法在测量数据处理中的应用_郑维悦.pdf

     文件        115  2019-03-19 15:27  approach1程序\论文例子\B.txt

     文件         85  2019-03-19 15:30  approach1程序\论文例子\d.txt

     文件        100  2019-03-19 15:31  approach1程序\论文例子\L.txt

     文件         60  2019-03-19 15:49  approach1程序\论文例子\P.txt

     文件         31  2019-03-19 15:56  approach1程序\论文例子\X0.txt

     文件         37  2019-03-19 09:54  approach1程序\课本例子\B.txt

     文件         22  2019-03-19 14:58  approach1程序\课本例子\d.txt

     文件         36  2019-03-19 15:00  approach1程序\课本例子\L.txt

     文件         26  2019-03-19 19:41  approach1程序\课本例子\P.txt

     文件         25  2019-03-19 15:01  approach1程序\课本例子\X0.txt

    ..A..H.     43008  2019-03-23 19:18  Approach1\.vs\Approach1\v15\.suo

     文件    6242304  2019-03-23 19:18  Approach1\.vs\Approach1\v15\Browse.VC.db

     文件   38928384  2019-03-18 19:02  Approach1\.vs\Approach1\v15\ipch\AutoPCH\1962b9ce214fdc38\MATRIX.ipch

     文件   31719424  2019-03-18 19:44  Approach1\.vs\Approach1\v15\ipch\AutoPCH\3f2c0adcc135cceb\MATRIX.ipch

     文件   32112640  2019-03-23 17:35  Approach1\.vs\Approach1\v15\ipch\AutoPCH\9d66d337902f06cc\APPROACH1.ipch

     文件   38928384  2019-03-18 19:00  Approach1\.vs\Approach1\v15\ipch\caf86dfaa2ef1336.ipch

    ..A..H.     46080  2019-05-11 18:16  Approach1\.vs\Approach1\v16\.suo

     文件    5423104  2019-05-11 18:16  Approach1\.vs\Approach1\v16\Browse.VC.db

     文件   32702464  2019-05-11 17:58  Approach1\.vs\Approach1\v16\ipch\AutoPCH\971830a3299df4b4\APPROACH1.ipch

     文件       7684  2019-03-19 20:12  Approach1\Approach1\Approach1.cpp

............此处省略73个文件信息

评论

共有 条评论