⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xppva.m

📁 GPS TOOLBOX包含以下内容: 1、GPS相关常量和转换因子; 2、角度变换; 3、坐标系转换: &#61656 点变换; &#61656 矩阵变换; &#61656 向量变换
💻 M
字号:
%                                xppva.m
%  Scope:   This MATLAB program determines acceleration from the input data of
%           time, position and velocity, and plots all relevant trajectory
%           information.
%  Usage:   xppva
%  Inputs:  - selection of the (1) default data file(s) or (2) user's defined data file
%             Each record of the ASCII input data file contains the following data:
%             - time, in seconds
%             - latitude, in radians
%             - longitude, in radians
%             - altitude, in meters
%             - East velocity component, in meters/second
%             - North velocity component, in meters/second
%             - Up velocity component, in meters/second
%           - name of the scenario/trajectory, e.g. Low/Medium/High Dynamics 
%  Outputs: - the following plots are executed
%             - plot 1 - trajectory latitude/longitude/altitude versus time
%             - plot 2 - trajectory latitude versus longitude
%             - plot 3 - trajectory East/North/Up velocity versus time
%             - plot 4 - trajectory East/North/Up acceleration versus time
%             - plot 5 - trajectory velocity/acceleration magnitude versus time
%  Last update:  12/23/00
%  Copyright (C) 2000 by LL Consulting. All Rights Reserved.

clear
close all
yes = 'y';

disp('  ');
answer1 = input('Do you want to use the default data file(s)? (y/n)[y]  ','s');
if isempty(answer1)
   answer1 = yes;
end
disp('  ');
if strcmp(answer1,yes)
   disp('Enter:   1   for the medium dynamics file posvelmd.dat');
   disp('         2   for the high dynamics file posvelhd.dat');
   icase = input('Make selection -->  ');
   if  icase == 1
      fname = 'posvelmd.dat';
   elseif  icase == 1
      fname = 'posvelhd.dat';
   else
      disp('Incorrect case selection ');
      disp('  ');
      break;
   end
else
   fname = input('Enter the name of the input data file (with extension) -- > ','s');
end   
inpdata = load(fname);

disp('  ');
disp('Enter Scenario name, e.g. Low/Medium/High Dynamics Scenario ');
aa = input('    --> ','s');
disp('  ');

time = inpdata(:,1);
lat = inpdata(:,2);
lon = inpdata(:,3);
alt = inpdata(:,4);
velE = inpdata(:,5);
velN = inpdata(:,6);
velU = inpdata(:,7);
dt = time(2) - time(1);    %  time step
dt2 = dt + dt;

[nrow,ncol] = size(inpdata);
n = max(nrow,ncol);

%  Plot the trajectory position

figure(1)
rad2deg = 180 / pi;
subplot(311)
plot(time,lat*rad2deg); grid;
aa1 = [aa '  -  Trajectory Latitude/Longitude/Altitude  versus  Time'];
title(aa1);
ylabel('Latitude, in degrees');

subplot(312)
plot(time,lon*rad2deg); grid;
ylabel('Longitude, in degrees');

subplot(313)
plot(time,alt); grid;
ylabel('Altitude, in meters');
xlabel('Time, in seconds');

figure(2)
plot(lon*rad2deg,lat*rad2deg); grid;
aa2 = [aa  '  -  Trajectory Latitude  versus  Longitude'];
title(aa2);
xlabel('Longitude, in degrees');
ylabel('Latitude, in degrees')

%  Plot the trajectory velocity

figure(3)
subplot(311)
plot(time,velE); grid;
aa3 = [aa  '  -  Trajectory East/North/Up Velocity  versus  Time'];
title(aa3);
ylabel('East Velocity, in m/s');

subplot(312)
plot(time,velN); grid;
ylabel('North Velocity, in m/s');

subplot(313)
plot(time,velU); grid;
ylabel('Up Velocity, in m/s');
xlabel('Time, in seconds');

%  Computation of the East acceleration component 

accE  = velE(3:n) - velE(1:n-2);
accE  = accE / dt2;
accE(2:n-1) = accE;
accE(1) = accE(2);
accE(n) = accE(n-1);

%  Computation of the North (acceleration and jerk) component 

accN  = velN(3:n) - velN(1:n-2);
accN  = accN / dt2;
accN(2:n-1) = accN;
accN(1) = accN(2);
accN(n) = accN(n-1);

%  Computation of the Up (acceleration and jerk) component 

accU  = velU(3:n) - velU(1:n-2);
accU  = accU / dt2;
accU(2:n-1) = accU;
accU(1) = accU(2);
accU(n) = accU(n-1);

%  Plot trajectory acceleration

figure(4)
subplot(311)
plot(time,accE); grid;
aa4 = [aa  '  -  Trajectory East/North/Up Acceleration  versus  Time'];
title(aa4);
ylabel('East Acceleration, in m/s^2');

subplot(312)
plot(time,accN); grid;
ylabel('North Acceleration, in m/s^2');

subplot(313)
plot(time,accU); grid;
ylabel('Up Acceleration, in m/s^2');
xlabel('Time, in seconds');

%  Plot velocity and acceleration magnitude

figure(5)
subplot(211)
vel = sqrt(velE.^2 + velN.^2 + velU.^2);
plot(time,vel); grid;
aa61 = [aa '  - Trajectory Velocity Magnitude  versus  Time'];
title(aa61);
ylabel('Velocity Magnitude, in m/s');

subplot(212)
acc = sqrt(accE.^2 + accN.^2 + accU.^2);
plot(time,acc); grid;
aa62 = [aa '  - Trajectory Acceleration Magnitude  versus  Time'];
title(aa62);
xlabel('Time, in seconds');
ylabel('Acceleration Magnitude, in m/s^2');

disp ('End of the program  XPPVA ');
disp ('  ');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -