-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainfunc2.m
85 lines (79 loc) · 2.3 KB
/
Mainfunc2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
tic
clear;
close all;
addpath('Quaternions');
filePath = 'Datasets/imudata15.xlsx';
IMUdata= xlsread(filePath);
time = zeros(1,size(IMUdata,1));
dt = 1/100;
for i=1:size(IMUdata,1)
time(i) = (i-1)*dt;
end
[Pos_whole,Vel_whole,Att_whole,PosError_whole,VelError_whole,AttError_whole] = TraceState(IMUdata,dt);
% Plot translational Attitude
figure('Position', [9 39 900 300], 'NumberTitle', 'off', 'Name', 'Attitude');
hold on;
plot(time, Att_whole(:,1), 'r');
plot(time, Att_whole(:,2), 'g');
plot(time, Att_whole(:,3), 'b');
title('Attitude');
xlabel('Time (s)');
ylabel('Attitude (rad)');
legend('Pitch', 'Roll', 'Azimuth');
hold off;
% Plot translational velocity
figure('Position', [9 39 900 300], 'NumberTitle', 'off', 'Name', 'Velocity');
hold on;
plot(time, Vel_whole(:,1), 'r');
plot(time, Vel_whole(:,2), 'g');
plot(time, Vel_whole(:,3), 'b');
title('Velocity');
xlabel('Time (s)');
ylabel('Velocity (m/s)');
legend('E', 'N', 'U');
hold off;
% Plot translational position
figure('Position', [9 39 900 600], 'NumberTitle', 'off', 'Name', 'PositionXYZ');
hold on;
plot(time, Pos_whole(:,1), 'r');
plot(time, Pos_whole(:,2), 'g');
plot(time, Pos_whole(:,3), 'b');
title('PositionXYZ');
xlabel('Time (s)');
ylabel('Position (m)');
legend('E', 'N', 'U');
hold off;
% Plot translational Attitude_error
figure('Position', [9 39 900 300], 'NumberTitle', 'off', 'Name', 'Attitude_error');
hold on;
plot(time, AttError_whole(:,1), 'r');
plot(time, AttError_whole(:,2), 'g');
plot(time, AttError_whole(:,3), 'b');
title('Attitude_error');
xlabel('Time (s)');
ylabel('Attitude_error (rad)');
legend('Pitch', 'Roll', 'Azimuth');
hold off;
% Plot translational Velocity_error
figure('Position', [9 39 900 300], 'NumberTitle', 'off', 'Name', 'Velocity_error');
hold on;
plot(time, VelError_whole(:,1), 'r');
plot(time, VelError_whole(:,2), 'g');
plot(time, VelError_whole(:,3), 'b');
title('Velocity_error');
xlabel('Time (s)');
ylabel('Velocity_error (m/s)');
legend('E', 'N', 'U');
hold off;
% Plot translational Position_Error
figure('Position', [9 39 900 300], 'NumberTitle', 'off', 'Name', 'Position_Error');
hold on;
plot(time, PosError_whole(:,1), 'r');
plot(time, PosError_whole(:,2), 'g');
plot(time, PosError_whole(:,3), 'b');
title('Position_Error');
xlabel('Time (s)');
ylabel('Position_Error');
legend('La', 'Lo', 'H');
hold off;
t = toc;