PSINS工具箱函数介绍——gpsplot

介绍gpsplot函数的原理和作用

程序源码

function gpsplot(vpGPS, ts)
% GPS plot.
%
% Prototype: gpsplot(vpGPS, ts)
% Inputs: vpGPS - [vnGPS, posGPS, tag, t] or [posGPS, tag, t]
%              the tag column may not exist.
%         ts - GPS sampling interval
%          
% See also  imuplot, insplot, gpsload, gpssimu, avpfile, igsplot, gpssatplot, pos2dplot, pos2bd.

% Copyright(c) 2009-2014, by Gongmin Yan, All rights reserved.
% Northwestern Polytechnical University, Xi An, P.R.China
% 19/02/2014
global glv
    [m,n] = size(vpGPS);
    if nargin<2, ts=1; end
    if mod(n,3)==0, vpGPS = [vpGPS,(1:length(vpGPS))'*ts]; end
    t = vpGPS(:,end);
    if t(1)>10000
        t = t+(t(2)-2*t(1));
    end
    if mod(n,3)==1  % if not exist tag, then add 1
        vpGPS=[vpGPS(:,1:end-1),ones(m,1),vpGPS(:,end)];  
    end
    idx = find(vpGPS(:,end-1)==0);
    myfigure,
    if n>=6  % if include velocity & position
        vnS = vpGPS(:,1:3); posS = vpGPS(:,4:6);
%         subplot(221), plot(t, vnS); xygo('V');
        subplot(221), plot(t, [vnS,normv(vnS)]); xygo('V');
        hold on, plot(t(idx), vnS(idx,:), 'c*');
        subplot(223), plot(t, [[posS(:,1)-posS(1,1),(posS(:,2)-posS(1,2))*cos(posS(1,1))]*glv.Re,posS(:,3)-posS(1,3)]); xygo('DP');
            hold on, plot(t(idx), [[posS(idx,1)-posS(1,1),(posS(idx,2)-posS(1,2))*cos(posS(1,1))]*glv.Re,posS(idx,3)-posS(1,3)], 'c*');
        subplot(2,2,[2,4]), plot3(r2d(posS(:,2)), r2d(posS(:,1)), posS(:,3)); xygo('lon', 'lat');
            hold on, plot3(r2d(posS(idx,2)), r2d(posS(idx,1)), posS(idx,3), 'c*'), plot3(r2d(posS(1,2)), r2d(posS(1,1)), posS(1,3), 'rp');
    else  % position only
        posS = vpGPS(:,1:3);
        subplot(121), plot(t, [[posS(:,1)-posS(1,1),(posS(:,2)-posS(1,2))*cos(posS(1,1))]*glv.Re,posS(:,3)-posS(1,3)]); xygo('DP');
            hold on, plot(t(idx), [[posS(idx,1)-posS(1,1),(posS(idx,2)-posS(1,2))*cos(posS(1,1))]*glv.Re,posS(idx,3)], 'c*');
        title(sprintf('pos0=[%.6f, %.6f, %.3f]', r2dm(posS(1,1)), r2dm(posS(1,2)), posS(1,3)));
        subplot(122), plot3(r2d(posS(:,2)), r2d(posS(:,1)), posS(:,3)); xygo('lon', 'lat'); zlabel(labeldef('H'));
            hold on, plot3(r2d(posS(idx,2)), r2d(posS(idx,1)), posS(idx,3), 'c*'), plot3(r2d(posS(1,2)), r2d(posS(1,1)), posS(1,3), 'rp');
    end

MATLAB截图(部分):
在这里插入图片描述

作用

正如源码注释里面说的那样,输入为GPS/GNSS的数据,输出为对其速度、位置绘图。
输入信息中,每时刻数据按行给出。东北天速度在前、纬经高在中间,最后给时间戳。如下图所示:
在这里插入图片描述

【注意】纬度经度为弧度制,这在源码中能看出来:

subplot(2,2,[2,4]), plot3(r2d(posS(:,2)), r2d(posS(:,1)), posS(:,3)); xygo('lon', 'lat');

上面代码片中,r2d即为弧度转化为角度的函数。
【更多关于r2d的介绍,参考:http://t.csdnimg.cn/OciQD

  • 若输入没有速度信息(输入量不足6列),则只绘制位置
  • 若输入没有时间戳(输入量为3的倍数,即3或6),则补全时间戳

运行结果讲解

运行后,得到的图片如下:
在这里插入图片描述
左上角是速度三轴曲线,搜下叫是位移三轴曲线,右边是未知三维图像。

  • 8
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MATLAB卡尔曼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值