严恭敏老师PSINS工具箱解读——glvf

glvf——对工具箱的全局变量进行初始化

function glv1 = glvf(Re, f, wie) 
                         ——`根据参考椭球的长半轴、扁率和自转角速率确定相应参考椭球的其它参数`
% PSINS Toolbox global variable structure initialization. ——`对工具箱的全局变量进行初始化`
%
% Prototype: glv = glvf(Re, f, wie) 
                             ——`Re:长半轴、f:扁率、wie:自转角速率;glv:椭球参数的结构体`
% Inputs: Re - the Earth's semi-major axis
%         f - flattening
%         wie - the Earth's angular rate
% Output: glv1 - output global variable structure array
%
% See also  psinsinit.

% Copyright(c) 2009-2014, by Gongmin Yan, All rights reserved.
% Northwestern Polytechnical University, Xi An, P.R.China
% 14/08/2011, 10/09/2013, 09/03/2014
global glv ——`全局变量glv`
    if ~exist('Re', 'var'),  Re = [];  end ——`如果变量Re不存在就使其为空`
    if ~exist('f', 'var'),   f = [];  end ——`如果变量f不存在就使其为空`
    if ~exist('wie', 'var'), wie = [];  end ——`如果变量wie不存在就使其为空`
    if isempty(Re),  Re = 6378137;  end ——`如果变量Re为空就给其赋值`
    if isempty(f),   f = 1/298.257;  end ——`如果变量f为空就给其赋值`
    if isempty(wie), wie = 7.2921151467e-5;  end ——`如果变量wie为空就给其赋值`
    glv.Re = Re;                    % the Earth's semi-major axis ——`长半轴`
    glv.f = f;                      % flattening ——`扁率`
    glv.Rp = (1-glv.f)*glv.Re;      % semi-minor axis ——`短半轴`
    glv.e = sqrt(2*glv.f-glv.f^2); glv.e2 = glv.e^2; % 1st eccentricity ——`第一偏心率`
    glv.ep = sqrt(glv.Re^2-glv.Rp^2)/glv.Rp; glv.ep2 = glv.ep^2; % 2nd eccentricity
                                                                        ——`第二偏心率`
    glv.wie = wie;                  % the Earth's angular rate ——`自转角速率`
    glv.meru = glv.wie/1000;        % milli earth rate unit ——`自转角速率的千分之一`
    glv.g0 = 9.7803267714;          % gravitational force ——`重力`
    glv.mg = 1.0e-3*glv.g0;         % milli g ——`单位:毫g`
    glv.ug = 1.0e-6*glv.g0;         % micro g ——`单位:微g`
    glv.mGal = 1.0e-3*0.01;         % milli Gal = 1cm/s^2 ~= 1.0E-6*g0
    glv.ugpg2 = glv.ug/glv.g0^2;    % ug/g^2
    glv.ws = 1/sqrt(glv.Re/glv.g0); % Schuler frequency
    glv.ppm = 1.0e-6;               % parts per million ——`百万分之一`
    glv.deg = pi/180;               % arcdeg ——`单位:弧度`
    glv.min = glv.deg/60;           % arcmin ——`单位:弧分`
    glv.sec = glv.min/60;           % arcsec ——`单位:弧秒`
    glv.hur = 3600;                 % time hour (1hur=3600second)
    glv.dps = pi/180/1;             % arcdeg / second
    glv.dph = glv.deg/glv.hur;      % arcdeg / hour
    glv.dpss = glv.deg/sqrt(1);     % arcdeg / sqrt(second)
    glv.dpsh = glv.deg/sqrt(glv.hur);  % arcdeg / sqrt(hour)
    glv.dphpsh = glv.dph/sqrt(glv.hur); % (arcdeg/hour) / sqrt(hour)
    glv.Hz = 1/1;                   % Hertz
    glv.dphpsHz = glv.dph/glv.Hz;   % (arcdeg/hour) / sqrt(Hz)
    glv.ugpsHz = glv.ug/sqrt(glv.Hz);  % ug / sqrt(Hz)
    glv.ugpsh = glv.ug/sqrt(glv.hur); % ug / sqrt(hour)
    glv.mpsh = 1/sqrt(glv.hur);     % m / sqrt(hour)
    glv.mpspsh = 1/1/sqrt(glv.hur); % (m/s) / sqrt(hour), 1*mpspsh~=1700*ugpsHz
    glv.ppmpsh = glv.ppm/sqrt(glv.hur); % ppm / sqrt(hour)
    glv.mil = 2*pi/6000;            % mil
    glv.nm = 1853;                  % nautical mile ——`单位:海里`
    glv.kn = glv.nm/glv.hur;        % knot ——`单位:节-海洋中的速度单位`
    %%
    glv.wm_1 = [0,0,0];   % the init of previous gyro ——`陀螺仪角度增量`
    glv.vm_1 = [0,0,0];   % the init of previous acc sample ——`加速度计速度增量`
    glv.cs = [          % coning & sculling compensation coefficients ——`锥度和双桨补偿系数`
        [2,    0,    0,    0,    0    ]/3
        [9,    27,   0,    0,    0    ]/20
        [54,   92,   214,  0,    0    ]/105
        [250,  525,  650,  1375, 0    ]/504 
        [2315, 4558, 7296, 7834, 15797]/4620 ];
    glv.csmax = size(glv.cs,1)+1;  % max subsample number ——`最大子样本数`
    glv.v0 = [0;0;0];    % 3x1 zero-vector
    glv.qI = [1;0;0;0];  % identity quaternion
    glv.I33 = eye(3); glv.o33 = zeros(3);  % identity & zero 3x3 matrices
    glv.pos0 = [34.246048*glv.deg; 108.909664*glv.deg; 380]; % position of INS Lab@NWPU
    glv.eth = []; glv.eth = earth(glv.pos0); ——`利用earth函数计算地球的相关参数`
    %%
    [glv.rootpath, glv.datapath, glv.mytestflag] = psinsenvi; ——`工具箱根路径、输出数据的
                                                             保存路径和测试程序的保存路径`
    glv1 = glv; ——`输出全局变量的结构体`


你可能感兴趣的:(matlab,算法)