www.pudn.com > GNSS_SDR.zip > plotNavigation.m, change:2009-12-07,size:6796b


function plotNavigation(navSolutions, settings) 
%Functions plots variations of coordinates over time and a 3D position 
%plot. It plots receiver coordinates in UTM system or coordinate offsets if 
%the true UTM receiver coordinates are provided.   
%绘制三维定位结果 
%plotNavigation(navSolutions, settings) 
% 
%   Inputs: 
%       navSolutions    - Results from navigation solution function. It 
%                       contains measured pseudoranges and receiver 
%                       coordinates. 
%                       - 定位结果,包括伪距和接收机位置坐标 
%       settings        - Receiver settings. The true receiver coordinates 
%                       are contained in this structure. 
%                       - 设置 
 
%-------------------------------------------------------------------------- 
%                           SoftGNSS v3.0 
%  
% Copyright (C) Darius Plausinaitis 
% Written by Darius Plausinaitis 
% 注释翻译:文立 
%-------------------------------------------------------------------------- 
%This program is free software; you can redistribute it and/or 
%modify it under the terms of the GNU General Public License 
%as published by the Free Software Foundation; either version 2 
%of the License, or (at your option) any later version. 
% 
%This program is distributed in the hope that it will be useful, 
%but WITHOUT ANY WARRANTY; without even the implied warranty of 
%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
%GNU General Public License for more details. 
% 
%You should have received a copy of the GNU General Public License 
%along with this program; if not, write to the Free Software 
%Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
%USA. 
%程序为开源程序,请在开源协议规定范围内做改动 
%-------------------------------------------------------------------------- 
 
% CVS record: 
% $Id: plotNavigation.m,v 1.1.2.25 2006/08/09 17:20:11 dpl Exp $ 
% 翻译时间:2009-05-13 
 
%% Plot results in the necessary data exists 绘图========================== 
if (~isempty(navSolutions)) 
 
    %% If reference position is not provided, then set reference position 
    %% to the average postion 
    %% 如果参考位置未知,则取平均值为参考位置 
    if isnan(settings.truePosition.E) || isnan(settings.truePosition.N) ... 
                                      || isnan(settings.truePosition.U) 
 
        %=== Compute mean values 计算平均值================================= 
        % Remove NaN-s or the output of the function MEAN will be NaN. 
        % 删除NAN 
        refCoord.E = mean(navSolutions.E(~isnan(navSolutions.E))); 
        refCoord.N = mean(navSolutions.N(~isnan(navSolutions.N))); 
        refCoord.U = mean(navSolutions.U(~isnan(navSolutions.U))); 
 
        %Also convert geodetic coordinates to deg:min:sec vector format 
        %转换坐标为度分秒形式 
%         meanLongitude = dms2mat(deg2dms(... 
%             mean(navSolutions.longitude(~isnan(navSolutions.longitude)))), -5); 
%         meanLatitude  = dms2mat(deg2dms(... 
%             mean(navSolutions.latitude(~isnan(navSolutions.latitude)))), -5); 
 
%         refPointLgText = ['平均位置\newline  纬度: ', ... 
%                             num2str(meanLatitude(1)), '{\circ}', ... 
%                             num2str(meanLatitude(2)), '{\prime}', ... 
%                             num2str(meanLatitude(3)), '{\prime}{\prime}', ... 
%                          '\newline 经度: ', ... 
%                             num2str(meanLongitude(1)), '{\circ}', ... 
%                             num2str(meanLongitude(2)), '{\prime}', ... 
%                             num2str(meanLongitude(3)), '{\prime}{\prime}', ... 
%                          '\newline 高度: ', ... 
%                             num2str(mean(navSolutions.height(~isnan(navSolutions.height))), '%+6.1f')]; 
    else 
        refPointLgText = '参考位置'; 
        refCoord.E = settings.truePosition.E; 
        refCoord.N = settings.truePosition.N; 
        refCoord.U = settings.truePosition.U;         
    end     
      
    figureNumber = 300; 
    % The 300 is chosen for more convenient handling of the open 
    % figure windows, when many figures are closed and reopened. Figures 
    % drawn or opened by the user, will not be "overwritten" by this 
    % function if the auto numbering is not used. 
    % 选择300以防覆盖图片 
  
    %=== Select (or create) and clear the figure 生成新图片 ================ 
    figure(figureNumber); 
    clf   (figureNumber); 
    set   (figureNumber, 'Name', '定位结果'); 
  
    %--- Draw axes 绘制坐标轴----------------------------------------------- 
    handles(1, 1) = subplot(4, 2, 1 : 4); 
    handles(3, 1) = subplot(4, 2, [5, 7]); 
    handles(3, 2) = subplot(4, 2, [6, 8]);     
  
%% Plot all figures 绘图=================================================== 
  
    %--- Coordinate differences in UTM system 绘出用户坐标系中坐标变化曲线--- 
    plot(handles(1, 1), [(navSolutions.E - refCoord.E)', ... 
                         (navSolutions.N - refCoord.N)',... 
                         (navSolutions.U - refCoord.U)']); 
  
    title (handles(1, 1), '用户坐标系中的坐标变化'); 
    legend(handles(1, 1), '东向', '北向', '天向'); 
    xlabel(handles(1, 1), ['测量周期: ', ... 
                                    num2str(settings.navSolPeriod), 'ms']); 
    ylabel(handles(1, 1), '变化量(m)'); 
    grid  (handles(1, 1)); 
    axis  (handles(1, 1), 'tight');     
  
    %--- Position plot in UTM system 绘出用户坐标系中的位置------------------ 
    plot3 (handles(3, 1), navSolutions.E - refCoord.E, ... 
                          navSolutions.N - refCoord.N, ...  
                          navSolutions.U - refCoord.U, '+'); 
    hold  (handles(3, 1), 'on'); 
    %Plot the reference point 绘制参考点 
    plot3 (handles(3, 1), 0, 0, 0, 'r+', 'LineWidth', 1.5, 'MarkerSize', 10); 
    hold  (handles(3, 1), 'off'); 
     
    view  (handles(3, 1), 0, 90); 
    axis  (handles(3, 1), 'equal'); 
    grid  (handles(3, 1), 'minor');     
     
    legend(handles(3, 1), '测量值', refPointLgText); 
  
    title (handles(3, 1), '用户坐标系中的位置 (3D)'); 
    xlabel(handles(3, 1), '东向(m)'); 
    ylabel(handles(3, 1), '北向(m)'); 
    zlabel(handles(3, 1), '天向(m)'); 
     
    %--- Satellite sky plot 卫星位置图-------------------------------------- 
    skyPlot(handles(3, 2), ... 
            navSolutions.channel.az, ... 
            navSolutions.channel.el, ... 
            navSolutions.channel.PRN(:, 1)); 
         
    title (handles(3, 2), ['卫星位置及可见情况(平均PDOP= ', ... 
                               num2str(mean(navSolutions.DOP(2,:))), ')']);   
                            
else 
    disp('没有足够的导航数据以供绘图!'); 
end % if (~isempty(navSolutions))