-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotyu.m
47 lines (44 loc) · 1.11 KB
/
plotyu.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
function plotyu(out,varargin)
p = inputParser;
addParameter(p, 'ulim', [-1 1]);
addParameter(p, 'ylim', 0);
addParameter(p,'ulegend',{});
addParameter(p,'ylegend',{});
addParameter(p,'un',0);
addParameter(p,'yn',0);
parse(p, varargin{:});
ulim = p.Results.ulim;
ylim = p.Results.ylim;
ulegend = p.Results.ulegend;
ylegend = p.Results.ylegend;
un = p.Results.un;
yn = p.Results.yn;
figure
if un~=0
plot(out.u.time, out.u.signals.values(:,un));
else
plot(out.u.time, out.u.signals.values);
end
title('Controllo');
xlabel('Tempo (s)');
ylabel('Ampiezza');
axis([out.u.time(1) out.u.time(end) ulim])
if isempty(ulegend) ~= 1
legend(ulegend);
end
figure
if un~=0
plot(out.y.time, out.y.signals.values(:,yn));
else
plot(out.y.time, out.y.signals.values);
end
title('Uscite');
xlabel('Tempo (s)');
ylabel('Velocità (m/s - rad/s)');
if isempty(ylegend) ~= 1
legend(ylegend);
end
if ylim ~= 0
axis([out.y.time(1) out.y.time(end) ylim])
end
end