-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotOneShot.m
57 lines (51 loc) · 1.71 KB
/
plotOneShot.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
clear all
close all
load("cache\p2keq2.mat")
fig = figure('Renderer', 'painters', 'Position', [10 10 900 900]);
clf;
bd = 25;
% xlim([-bd bd]);
% ylim([-bd bd]);
grid on
hold on
Z = conZonotope([1 2 2 2 6 2 8;1 2 2 0 5 0 6 ],[],[]);
%measUpdateGrp{1}=Z;
%h_measSet{2} = plotCZono(measUpdateGrp{1},[1,2],'black','+');
clf;
bd = 25;
grid on
hold on
box on
hpoint = plot(x(1,k+1),x(2,k+1),'x','LineWidth',Blacklinwid+1);
for j=1:2
hMeasSet= plotZono(measSet{j},[1,2],'blue','+','LineWidth',Linwid);
end
hMeasSetAttacked= plotZono(measSet{3},[1,2],'red','*','LineWidth',Linwid);
for j=1:length(timeUpdateGrp)
hTimeUpdate= plotCZono(timeUpdateGrp{j},[1,2],'green','+','LineWidth',Linwid);
end
for j=1:length(measUpdateGrp)
hMeasUpdate=plotCZono(measUpdateGrp{j},[1,2],'black','+','LineWidth',Blacklinwid);
end
warOrig = warning; warning('off','all');
warning(warOrig);
ax = gca;
ax.FontSize = 26;
%set(gcf, 'Position', [50, 50, 800, 400])
ax = gca;
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + ti(1);
bottom = outerpos(2) + ti(2);
ax_width = outerpos(3) - ti(1) - ti(3);
ax_height = outerpos(4) - ti(2) - ti(4);
ax.Position = [left bottom ax_width ax_height];
yticks(-6:2:8);
xticks(-5:2:6);
ylim([-6 8])
xlim([-5.5 5])
Yattstr =strcat(' $\mathcal{Y}^', num2str(indexAtt) ,'_k$');
legend([hpoint,hMeasSet,hMeasSetAttacked,hTimeUpdate,hMeasUpdate],...
'True state $x(k)$',strcat('Safe $\mathcal{Y}_k^',safeIndexStrA,' $\mathcal{Y}_k^',safeIndexStrB),strcat('Attacked',Yattstr),'Time update $\hat{\mathcal{X}}_{k|k-1}$','Meas. update $\hat{\mathcal{X}}_{k|k}$','Location','northwest','Interpreter','latex');
xlabel('$x_1(k)$','Interpreter','latex');
ylabel('$x_2(k)$','Interpreter','latex');