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
function [DMD] = DMD_InfluenceComputation(DATA,DMD)
% This function DMD_InfluenceComputation computes the influence of DMD
% components (see Eq. 20)
%
%
% [DMD] = DMD_InfluenceComputation(DATA,DMD)
%
% Input: a struct DATA and a struct DMD with the following properties 
%   * DATA.type
%   * DATA.scalingDiag <-- optional and only for multivariate data
%   * DMD.lambda
%   * DMD.ThetaScaled
%
% Output: 
%   * DMD.influenceDiagK

if(DATA.type == "univariate")
    
    for k = 1:length(DMD.lambda)
        DMD.influenceDiagK(k) = norm(TOOL_DiagonalAveragingMulti(real(DMD.ThetaScaled(:,k) * DMD.lambda(k).^(0:DATA.m)),DATA.delayParameter), "fro");
    end

elseif(DATA.type == "multivariate")

    if(isfield(DATA,'scalingDiag'))
        scalingMatrix = diag(1./vecnorm(DATA.timeSeries,2,2)) * diag(DATA.scalingDiag);
    else
        scalingMatrix = diag(1./vecnorm(DATA.timeSeries,2,2));
    end
    
    for k = 1:length(DMD.lambda)
        DMD.influenceDiagK(k) = norm(scalingMatrix*TOOL_DiagonalAveragingMulti(real(DMD.ThetaScaled(:,k) * DMD.lambda(k).^(0:DATA.m)),DATA.delayParameter), "fro");
    end

end

end