-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_ye.m
77 lines (75 loc) · 2.19 KB
/
plot_ye.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
function plot_ye(y,ye,plots)
%PLOT_YE Plots pairwisely the estimated output and given output
% trajectories.
%
% PLOT_YE(Y,Ye) plots pairwisely the trajectories
% Y(:,k), and Ye(:,k), for k = 1:l, l = size(Y,2).
%
% PLOT_YE(Y,Ye,PLOTS) the figure window is broken into
% maximum PLOTS(1)-by-PLOTS(2) subplots.
% Default: PLOTS = [min(2,l),1].
%
% RELEASE 2.0 of SLICOT System Identification Toolbox.
% Based on SLICOT RELEASE 5.7, Copyright (c) 2002-2020 NICONET e.V.
%
% V. Sima 30-12-2000.
%
% Revisions:
% V. Sima 30-03-2002, 03-03-2009.
%
global pause_wait % This could be used in pause(n) command.
%
if ~exist('pause_wait', 'var') || isempty(pause_wait),
pause_wait = -1; % Standard command pause is used by default.
end
nin = nargin;
%
if nin < 2
disp('Usage: PLOT_YE(Y,Ye)')
disp(' PLOT_YU(Y,Ye,PLOTS)')
return
end
%
l = size(y,2);
if nin < 3 || isempty(plots), plots = [min(2,l),1]; end
%
axis on
nplots = min( plots(1)*plots(2), l );
nplcrt = nplots;
npl = mod( l, nplots );
nloops = fix( l/nplots );
if ~( npl == 0 ),
nloops = nloops + 1;
else
npl = nplots;
end
%
for k = 1 : nloops,
if k == nloops, nplcrt = npl; end
for np = 1 : nplcrt,
j = ( k - 1 )*nplots + np;
err2 = norm(y(:,j) - ye(:,j))/max( eps, norm(y(:,j)));
subplot(plots(1),plots(2),np), plot([y(:,j) ye(:,j)])
if plots(1) <= 2,
if plots(2) <= 2,
title(['norm(Y_{',num2str(j),'}-Ye_{',num2str(j),...
'})/norm(Y_{',num2str(j),'}) = ' ,num2str( err2 )])
elseif plots(2) <= 4,
title(['Relerr_{',num2str(j),'} = ' ,num2str( err2 )])
end
end
if ismember( np, ( nplcrt - plots(2) + 1 : nplcrt ) ), xlabel('Samples'); end
ylabel(['Y_{', num2str(j), '},', 'Ye_{', num2str(j), '}'])
end
if k < nloops || nloops == 1,
if k == 1 && pause_wait < 0,
disp(' '); disp('Press any key to continue'),
end
if nloops > 1,
shg, if pause_wait < 0, pause, else pause(pause_wait), end, clf,
end
end
end
if pause_wait < 0, pause, else pause(pause_wait), end, close(gcf)
%
% end plot_ye