function caluserposition=calculateuserposition(SatellitePosition)
global SatellitePosition
%单独运行此程序时候,为调用前面程序而得的satelliteposotion结果,应该声明satelliteposotion为全局变量,即应该在satelliteposition前面加上global
r1=6400; %地球半径
c=300000;
deltat=0.00001;
satelliteposnew=ones(1,3);
vissatnum=0;
calculateok=1;
for k=1:24
if(SatellitePosition(k,4)==1)vissatnum=vissatnum+1;
satelliteposnew=[satelliteposnew;SatellitePosition(k,1:3)];
end
end
satelliteposnew(1,:)=[];
if(vissatnum<4)
calculateok=0;
caluserposition=[0 0 0 0];
return
end
prange=ones(1,vissatnum);
userpos=SatellitePosition(25,1:3);
for n=1:vissatnum
prange(1,n)=sqrt((satelliteposnew(n,:)-userpos)*(satelliteposnew(n,:)-userpos)')+c*deltat;
end
calculaterecord=[0 0 0];
xyz0=[0 0 0];
deltat0=0;
wxyz=satelliteposnew;
Error=1000;
computertime=0;
while((Error>0.00001)&(computertime<1000))
computertime=computertime+1;
r=ones(1,vissatnum);
for n=1:vissatnum
r(1,n)=sqrt((wxyz(n,:)-xyz0)*(wxyz(n,:)-xyz0)')+deltat0*c;
end
deltap=r-prange;
A=ones(vissatnum,3);
for n=1:vissatnum
A(n,:)=(wxyz(n,:)-xyz0)./r(1,n);
end
H=[A ones(vissatnum,1)];
deltax=inv(H'*H)*H'*deltap';
tempdeltax=deltax(1:3)
Error=max(abs(tempdeltax));
xyz0=xyz0+deltax(1:3,:)';
if(computertime<1000)
calculaterecord=[calculaterecord;xyz0];
end
deltat0=deltax(4,1)/(-c);
end
calculaterecord;
if(computertime==1000)
caluserposition=[99999999999 99999999999 999999999999];
else
caluserposition=[xyz0;calculaterecord];
end
gps.rar_GPS_gps单点定位_matlab 单点定位_单点定位_最小二乘法 GPS
版权申诉
5星 · 超过95%的资源 24 浏览量
2022-09-24
22:01:16
上传
评论 2
收藏 4KB RAR 举报
我虽横行却不霸道
- 粉丝: 75
- 资源: 1万+
最新资源
- 水稻病害基于Yolov8算法优化目标检测识别与AI辅助决策python源码+模型+使用说明.zip
- 海尔618算价表_七海5.20_16.00xlsx(1)(2).xlsx
- WebCrawler.scr
- 【计算机专业毕业设计】大学生就业信息管理系统设计源码.zip
- YOLO 数据集:8种路面缺陷病害检测【包含划分好的数据集、类别class文件、数据可视化脚本】
- JAVA实现Modbus RTU或Modbus TCPIP案例.zip
- 基于YOLOv8的FPS TPS AI自动锁定源码+使用步骤说明.zip
- JAVA实现Modbus RTU或Modbus TCPIP案例.zip
- 基于yolov8+streamlit的火灾检测部署源码+模型.zip
- 测试aaaaaaabbbbb
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论3