当前位置:网站首页>GPS高程拟合抗差中误差的求取代码实现
GPS高程拟合抗差中误差的求取代码实现
2022-07-06 09:18:00 【Proletarians】
话不多说,直接上代码了,c代码
// 2.1、使用中位数法,而非算术中位法
qsort(tmp_v_res, ns, sizeof(double), cmpres);
median_v_res =median(tmp_v_res, ns);// 观测值中数 Eq.14
// 2.1.1 求取偏离量,中心化
for (j = 0; j < ns; j++) {
tmp_v_res[j] -= median_v_res;// Eq.15
/*v_res[j] -= median_v_res;*/
if (tmp_v_res[j] < 0) tmp_v_res[j] *= -1;//取绝对值
}
// 2.1.2 使用中位数计算方差因子
qsort(tmp_v_res, ns, sizeof(double), cmpres);
median_v_res = median(tmp_v_res, ns);//观测值中数
sigma1 = median_v_res / 0.6745;// Eq.17
printf("抗差单位权中误差(weighted)sigma1= %f\n", sigma1);
/* 残差比较 */
static int cmpres(const void *p1, const void *p2){
double *q1 = (double *)p1, *q2 = (double *)p2;
double tt = (*q1) - (*q2);
return tt<-0.0 ? -1 : (tt>0.0 ? 1 : 0);
}
/* 求中位数 */
static double median(const double* A,unsigned int n){
if (n>0){
return (n & 1 == 1) ? A[(n - 1) / 2] : (A[n / 2] + A[n / 2 - 1]) / 2;
}
return 0;
}
边栏推荐
- idea问题记录
- VLSM variable length subnet mask partition tips
- JS Title: input array, exchange the largest with the first element, exchange the smallest with the last element, and output array.
- JUC forkjoin and completable future
- Redis cache update strategy, cache penetration, avalanche, breakdown problems
- Single chip Bluetooth wireless burning
- Mysqldump error1066 error solution
- [Offer29] 排序的循环链表
- Fairygui gain buff value change display
- Expected value (EV)
猜你喜欢

Idea problem record

(4) Data visualization of R language -- matrix chart, histogram, pie chart, scatter chart, linear regression and strip chart

Unity3D基础入门之粒子系统(属性介绍+火焰粒子系统案例制作)

FairyGUI简单背包的制作

Single chip Bluetooth wireless burning

FGUI工程打包发布&导入Unity&将UI显示出来的方式

Pytorch: tensor operation (I) contiguous

ESP8266连接onenet(旧版MQTT方式)

SVN更新后不出现红色感叹号

Theoretical derivation of support vector machine
随机推荐
Minio文件下载问题——inputstream:closed
[offer18] delete the node of the linked list
Halcon knowledge: gray_ Tophat transform and bottom cap transform
KF UD分解之伪代码实现进阶篇【2】
1041 be unique (20 points (s)) (hash: find the first number that occurs once)
What is the maximum length of MySQL varchar field
FairyGUI簡單背包的制作
Conditional probability
341. Flatten nested list iterator
JS function promotion and declaration promotion of VaR variable
Particle system for introduction to unity3d Foundation (attribute introduction + case production of flame particle system)
CUDA C programming authoritative guide Grossman Chapter 4 global memory
Minio file download problem - inputstream:closed
Page performance optimization of video scene
基于rtklib源码进行片上移植的思路分享
Office提示您的许可证不是正版弹框解决
Force buckle 1189 Maximum number of "balloons"
Compilation principle: preprocessing of source program and design and implementation of lexical analysis program (including code)
(四)R语言的数据可视化——矩阵图、柱状图、饼图、散点图与线性回归、带状图
(the first set of course design) sub task 1-5 317 (100 points) (dijkstra: heavy edge self loop)