当前位置:网站首页>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;
}
边栏推荐
- [offer9] implement queues with two stacks
- 音乐播放(Toggle && PlayerPrefs)
- 记一次云服务器被密码爆破的经历——关小黑屋、改密码、改端口
- 如何给Arduino项目添加音乐播放功能
- SSD technical features
- [Offer18]删除链表的节点
- (the first set of course design) 1-4 message passing interface (100 points) (simulation: thread)
- Walk into WPF's drawing Bing Dwen Dwen
- [Red Treasure Book Notes simplified version] Chapter 12 BOM
- Mysql database reports an error: row size too large (> 8126) Changing some columns to TEXT or BLOB or using ROW_ FORMAT=DY
猜你喜欢
Theoretical derivation of support vector machine
2021.11.10汇编考试
Unity3d makes the registration login interface and realizes the scene jump
CUDA C programming authoritative guide Grossman Chapter 4 global memory
Prove the time complexity of heap sorting
程序设计大作业:教务管理系统(C语言)
C programming exercise
Unity3D,阿里云服务器,平台配置
Guided package method in idea
Unity场景跳转及退出
随机推荐
[offer9]用两个栈实现队列
Unity3d, Alibaba cloud server, platform configuration
dosbox第一次使用
Servlet
@Autowired 和 @Resource 的区别
Guided package method in idea
MySQL takes up too much memory solution
Easy to use shortcut keys in idea
CUDA C programming authoritative guide Grossman Chapter 4 global memory
Meanings and differences of PV, UV, IP, VV, CV
Fairygui joystick
Problèmes avec MySQL time, fuseau horaire, remplissage automatique 0
编译原理:源程序的预处理及词法分析程序的设计与实现(含代码)
Fabrication of fairygui simple Backpack
Esp8266 connect onenet (old mqtt mode)
Combination of fairygui check box and progress bar
Walk into WPF's drawing Bing Dwen Dwen
Latex learning
What is the maximum length of MySQL varchar field
2021.11.10汇编考试