当前位置:网站首页>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;
}
边栏推荐
- FairyGUI摇杆
- Office prompts that your license is not genuine pop-up box solution
- Who says that PT online schema change does not lock the table, or deadlock
- How to add music playback function to Arduino project
- NRF24L01 troubleshooting
- PR 2021 quick start tutorial, first understanding the Premiere Pro working interface
- Walk into WPF's drawing Bing Dwen Dwen
- 编译原理:源程序的预处理及词法分析程序的设计与实现(含代码)
- Gateway fails to route according to the service name, and reports an error service unavailable, status=503
- [offer29] sorted circular linked list
猜你喜欢
FairyGUI循環列錶
FairyGUI简单背包的制作
单片机蓝牙无线烧录
Derivation of logistic regression theory
FairyGUI簡單背包的制作
Prove the time complexity of heap sorting
Halcon knowledge: gray_ Tophat transform and bottom cap transform
Database course design: college educational administration management system (including code)
2021.11.10汇编考试
Redis based distributed locks and ultra detailed improvement ideas
随机推荐
GNSS定位精度指标计算
FairyGUI摇杆
Idea problem record
[leetcode19] delete the penultimate node in the linked list
Unity3d, Alibaba cloud server, platform configuration
Office提示您的许可证不是正版弹框解决
地球围绕太阳转
Flink late data processing (3)
[leetcode622] design circular queue
NRF24L01故障排查
1041 Be Unique (20 point(s))(哈希:找第一个出现一次的数)
[offer78]合并多个有序链表
FairyGUI循环列表
[Leetcode15]三数之和
FairyGUI简单背包的制作
MySQL error warning: a long semaphore wait
(1) Introduction Guide to R language - the first step of data analysis
First use of dosbox
Compilation principle: preprocessing of source program and design and implementation of lexical analysis program (including code)
Lock wait timeout exceeded try restarting transaction