-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplot_policy.m
More file actions
77 lines (62 loc) · 1.08 KB
/
Copy pathplot_policy.m
File metadata and controls
77 lines (62 loc) · 1.08 KB
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
figure(1)
subplot(1,2,1)
plot(out.x1)
grid on
ylabel('x_1')
title('X_1 vs Time')
subplot(1,2,2)
plot(out.x2)
grid on
ylabel('x_2')
title('X_2 vs Time')
figure(2)
plot(out.u_obt)
grid on
ylabel('u')
title('Control vs Time')
figure(3)
p_a = [];
x_1a = [];
x_2a = [];
x_3a = [];
x_4a = [];
for i = 1:10:200
p_arr1 = out.P_arr(i,:);
p_a = [p_a;p_arr1];
x_1a = [x_1a;1];
x_2a = [x_2a;2];
x_3a = [x_3a;3];
x_4a = [x_4a;4];
end
p1n = [p_a(:,1)];
p2n = p_a(:,2);
p3n = p_a(:,3);
p4n = p_a(:,4);
subplot(2,2,1)
plot(x_1a,p1n,'*')
hold on
plot(1,1.297,'ro')
ylim([0,2])
title('Estimating P_{11}')
legend('Estimate','True')
subplot(2,2,2)
plot(x_2a,p2n,'*')
hold on
plot(2,0.1623,'ro')
ylim([0,2])
title('Estimating P_{12}')
legend('Estimate','True')
subplot(2,2,3)
plot(x_3a,p3n,'*')
hold on
plot(3,0.1623,'ro')
ylim([0,2])
title('Estimating P_{21}')
legend('Estimate','True')
subplot(2,2,4)
plot(x_4a,p4n,'*')
hold on
plot(4,0.3075,'ro')
ylim([0,2])
title('Estimating P_{22}')
legend('Estimate','True')