当前位置:网站首页>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;
}
边栏推荐
- (the first set of course design) sub task 1-5 317 (100 points) (dijkstra: heavy edge self loop)
- 如何给Arduino项目添加音乐播放功能
- [leetcode622] design circular queue
- ESP8266连接onenet(旧版MQTT方式)
- Teach you to release a DeNO module hand in hand
- @Autowired 和 @Resource 的区别
- Redis based distributed locks and ultra detailed improvement ideas
- Database course design: college educational administration management system (including code)
- (core focus of software engineering review) Chapter V detailed design exercises
- SVN更新后不出现红色感叹号
猜你喜欢

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

Unity3d, Alibaba cloud server, platform configuration

Problèmes avec MySQL time, fuseau horaire, remplissage automatique 0

Design and implementation of general interface open platform - (39) simple and crude implementation of API services

FairyGUI摇杆

Mysql database index

Teach you to release a DeNO module hand in hand

Derivation of logistic regression theory

Redis based distributed locks and ultra detailed improvement ideas

基於Redis的分布式ID生成器
随机推荐
Knowledge summary of request
音乐播放(Toggle && PlayerPrefs)
燕山大学校园网自动登录问题解决方案
(core focus of software engineering review) Chapter V detailed design exercises
Halcon knowledge: gray_ Tophat transform and bottom cap transform
Redis based distributed ID generator
Teach you to release a DeNO module hand in hand
Meanings and differences of PV, UV, IP, VV, CV
单片机蓝牙无线烧录
[offer29] sorted circular linked list
Combination of fairygui check box and progress bar
FairyGUI循環列錶
基于rtklib源码进行片上移植的思路分享
[leetcode19] delete the penultimate node in the linked list
PR 2021 quick start tutorial, first understanding the Premiere Pro working interface
关于Gateway中使用@Controller的问题
MySQL時間、時區、自動填充0的問題
[899] ordered queue
Gateway fails to route according to the service name, and reports an error service unavailable, status=503
There is no red exclamation mark after SVN update