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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153 | function [] = VIS_OverviewRepresentation(DATA, DMD, numberComps)
% This function VIS_OverviewRepresentation visualizes the filtered DMD
% components in an overview representation. The number of shown DMD
% components is given by the third input parameter 'numberComps'.
%
%
% [] = VIS_OverviewRepresentation(DATA, DMDOrig, numberComps)
%
% Input: A struct DATA, a struct DMD, and a parameter with the following
% properties
% * DATA.type
% * DATA.timeSeries
% * DATA.m
% * DATA.delayParameter
% * DMD.lambdaSort
% * DMD.ThetaScaledSort
% * DMD.filtering
% * numberComps
%
% Output: A visualization (figure with name 'Overview')
col = [228,026,028;055,126,184;077,175,074;152,078,163;255,127,000;255,255,051;166,086,040;251,180,174;179,205,227;204,235,197;222,203,228;254,217,166;255,255,204;229,216,189]./255;
I = DMD.filtering;
if DATA.type == "univariate"
tmp = 0;
tmp_sum = 0;
tmp_subplot = 1;
figure('Name','Overview')
for l = 1:length(DMD.lambdaSort)
k = I(l);
if(imag(DMD.lambdaSort(k)) < 1e-9)
tmp_plot = real(TOOL_DiagonalAveraging(DMD.ThetaScaledSort(:,k) * ...
DMD.lambdaSort(k).^(0:DATA.m)));
else
tmp_plot = 2*real(TOOL_DiagonalAveraging(DMD.ThetaScaledSort(:,k) * ...
DMD.lambdaSort(k).^(0:DATA.m)));
end
subplot(numberComps,3,tmp_subplot)
tmp_subplot=tmp_subplot+1;
p1=plot(1:length(tmp_plot),tmp_plot);
set(p1(1),'LineWidth',1,'Color',col(2,:));
title( sprintf('EV: %.2f%+.2fi \n period: %.3f \n magnitude: %.3f',...
real(DMD.lambdaSort(k)), imag(DMD.lambdaSort(k)) , ...
2*pi*1j/log(DMD.lambdaSort(k)./abs(DMD.lambdaSort(k))) , abs(DMD.lambdaSort(k)) ) )
box off
subplot(numberComps,3,tmp_subplot)
tmp_subplot=tmp_subplot+1;
tmp_sum = tmp_sum + tmp_plot;
p2=plot(1:length(DATA.timeSeries),DATA.timeSeries,1:length(tmp_sum),tmp_sum);
set(p2(1),'LineStyle','-','LineWidth',1,'Color',col(9,:));
set(p2(2),'LineWidth',1,'Color',col(2,:));
title( sprintf('absolute error -- mean: %.2f%', string(norm(abs(DATA.timeSeries-tmp_sum),1)/length(DATA.timeSeries)) ) )
box off
subplot(numberComps,3,tmp_subplot)
tmp_subplot=tmp_subplot+1;
DataOrigSubsampled = interp1(1:length(DATA.timeSeries),DATA.timeSeries,1:0.1:length(DATA.timeSeries));
tmp_sum_Subsampled = interp1(1:length(tmp_sum),tmp_sum,1:0.1:length(tmp_sum));
p3=plot( 1:0.1:length(DATA.timeSeries),abs(DataOrigSubsampled-tmp_sum_Subsampled) ); %./abs(DataOrig) )
set(p3(1),'LineWidth',1,'Color',col(2,:));
title( sprintf('absolute error -- mean: %.2f%', string(norm(abs(DATA.timeSeries-tmp_sum),1)/length(DATA.timeSeries)) ) )
axis([-inf inf -inf inf])
tmp = tmp + 1;
if(tmp == numberComps)
break
end
end
elseif DATA.type == "multivariate"
tmp = 0;
tmp_sum = 0;
tmp_subplot = 1;
figure('Name','Overview')
for l = 1:length(DMD.lambdaSort)
k = I(l);
if(imag(DMD.lambdaSort(k)) < 1e-9)
tmp_plot = real(TOOL_DiagonalAveragingMulti(DMD.ThetaScaledSort(:,k) * DMD.lambdaSort(k).^(0:DATA.m),DATA.delayParameter));
else
tmp_plot = 2*real(TOOL_DiagonalAveragingMulti(DMD.ThetaScaledSort(:,k) * DMD.lambdaSort(k).^(0:DATA.m),DATA.delayParameter));
end
subplot(numberComps,4,tmp_subplot)
tmp_subplot=tmp_subplot+1;
p1=plot(1:length(tmp_plot),tmp_plot(1,:));
set(p1(1),'LineWidth',1,'Color',col(5,:));
title( sprintf('EV: %f%+fi \t FREQ: %.3f \t ABS:%.4f' , real(DMD.lambdaSort(k)), imag(DMD.lambdaSort(k)) , 2*pi*1j/log(DMD.lambdaSort(k)./abs(DMD.lambdaSort(k))) , abs(DMD.lambdaSort(k)) ) )
axis([-inf, inf, -inf inf])
box off
subplot(numberComps,4,tmp_subplot)
tmp_subplot=tmp_subplot+1;
p1=plot(1:length(tmp_plot),tmp_plot(2,:));
set(p1(1),'LineWidth',1,'Color',col(4,:));
title( sprintf('EV: %f%+fi \t FREQ: %.3f \t ABS:%.4f' , real(DMD.lambdaSort(k)), imag(DMD.lambdaSort(k)) , 2*pi*1j/log(DMD.lambdaSort(k)./abs(DMD.lambdaSort(k))) , abs(DMD.lambdaSort(k)) ) )
axis([-inf, inf, -inf inf])
box off
subplot(numberComps,4,tmp_subplot)
tmp_subplot=tmp_subplot+1;
p1=plot(1:length(tmp_plot),tmp_plot(3,:));
set(p1(1),'LineWidth',1,'Color',col(2,:));
title( sprintf('EV: %f%+fi \t FREQ: %.3f \t ABS:%.4f' , real(DMD.lambdaSort(k)), imag(DMD.lambdaSort(k)) , 2*pi*1j/log(DMD.lambdaSort(k)./abs(DMD.lambdaSort(k))) , abs(DMD.lambdaSort(k)) ) )
axis([-inf, inf, -inf inf])
box off
subplot(numberComps,4,tmp_subplot)
tmp_subplot=tmp_subplot+1;
tmp_sum = tmp_sum + tmp_plot;
hold on
p2=plot(1:length(DATA.timeSeries),DATA.timeSeries(2:3,:),1:length(tmp_sum),tmp_sum(2:3,:));
set(p2(1),'LineWidth',1,'Color',col(11,:));
set(p2(2),'LineWidth',1,'Color',col(9,:));
set(p2(3),'LineWidth',1,'Color',col(4,:));
set(p2(4),'LineWidth',1,'Color',col(2,:));
yyaxis right
p3=plot(1:length(DATA.timeSeries),DATA.timeSeries(1,:),1:length(tmp_sum),tmp_sum(1,:));
set(p3(1),'LineWidth',1,'LineStyle', '-','Color',col(12,:));
set(p3(2),'LineWidth',1, 'LineStyle', '-','Color',col(5,:));
hold off
axis([-inf, inf, -inf inf])
title( strcat(num2str(norm(abs(DATA.timeSeries(1,:)-tmp_sum(1,:)),1)/length(DATA.timeSeries)), ",", ...
num2str(norm(abs(DATA.timeSeries(2,:)-tmp_sum(2,:)),1)/length(DATA.timeSeries)), ",", ...
num2str(norm(abs(DATA.timeSeries(3,:)-tmp_sum(3,:)),1)/length(DATA.timeSeries)) ))
tmp = tmp + 1;
if(tmp == numberComps)
break
end
end
end
end
|