-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_figures.m
More file actions
50 lines (47 loc) · 1.53 KB
/
Copy pathplot_figures.m
File metadata and controls
50 lines (47 loc) · 1.53 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
function h = plot_figures(ts, xs, A1, A2, Um, y_lim, kappa, visible)
if nargin < 8
visible = 'off';
end
disc = linspace(0, 2*pi, 100);
h = figure('visible', visible, 'position', 4*[0, 0, 400, 100]);
set(gcf, 'color', 'white')
axis tight manual% this ensures that getframe() returns a consistent size
pos_x = 0.04;
width_x = 0.2;
offset_x = 0.05;
for i = 1:4
subplot('Position', [pos_x+(i-1)*(width_x+offset_x) 0.12 width_x 0.82]);
if i == 1
plot(ts, xs');
ylim(y_lim);
xlabel('time [s]');
ylabel('input voltage');
title('x');
elseif i == 2
plot(ts, (A1*xs)');
ylim(y_lim);
xlabel('time [s]');
ylabel('V_a, V_b');
title('A*x (in abc)');
elseif i == 3
plot(ts, (A2([1 2],:)*xs)');
hold on;
plot(ts, Um*kappa*ones(1,length(ts)), 'k--');
plot(ts, -Um*kappa*ones(1,length(ts)), 'k--');
ylim(y_lim);
xlabel('time [s]');
ylabel('V_a, V_b');
title('B*x (in abc)');
elseif i == 4
plot((A1(1,:)*xs)', (A1(2,:)*xs)');
hold on;
plot((A2(1,:)*xs)', (A2(2,:)*xs)');
plot(Um*kappa*cos(disc), Um*kappa*sin(disc), 'k--');
xlim(y_lim);
ylim(y_lim);
xlabel('V_\alpha');
ylabel('V_\beta');
title('A*x, B*x (in \alpha\beta)');
end
drawnow;
end