-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathplot_results.m
90 lines (69 loc) · 2.47 KB
/
plot_results.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
86
87
88
89
90
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Plot Results %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% * Description: %
% - Plots the simulation results. %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% ======================================================================= %
% State estimation
% ======================================================================= %
figure();
% Experiment
e = 1;
% Final step
Nf = N;
for i = 1:n
subplot(n,1,i);
plot(0:Nf, x(i,1:Nf+1,e), ...
'k-', 'LineWidth', 1.5, ...
'DisplayName', 'Target System');
hold on;
grid on;
for f = 1:n_filters
plot(0:Nf, filters{f}.xf(i,1:Nf+1,e), ...
'LineStyle', '--', 'LineWidth', 1.5, ...
'DisplayName', filters{f}.id);
end
ylabel_str = sprintf('x_%d', i);
ylabel(ylabel_str);
xlabel('Time Step k');
legend();
end
% ======================================================================= %
% Estimation error variance of each variable
% ======================================================================= %
figure();
title('Error Variance');
for i = 1:n
subplot(n,1,i);
for f = 1:n_filters
plot(0:N, filters{f}.S1(i,1:N+1), ...
'LineStyle', '-', 'LineWidth', 1.5, ...
'DisplayName', filters{f}.id);
grid on;
hold on;
end
ylabel_str = sprintf('x_%d', i);
ylabel(ylabel_str);
xlabel('Time Step k');
legend();
end
% ======================================================================= %
% Estimation error variance (dB)
% ======================================================================= %
figure();
for f = 1:n_filters
semilogx(1:N+1, filters{f}.S2(1:N+1), ...
'LineStyle', '-', 'LineWidth', 1.5, ...
'DisplayName', filters{f}.id);
grid on;
hold on;
end
title('Error Variance');
xlabel('Time Step k');
ylabel('Error Variance (dB)');
legend();
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%