Extract output

Extract output

function [Zout, Aout, Znorm, varargout] = extract_output(z, outdof)
        

This function extracts the results of an SSM analysis along specified phase space coordinate directions.

$$\|\mathbf{z}\|_{L_2}=\sqrt{\frac{1}{T}\int_0^T\mathbf\|\mathbf{z}(t)\|^2dt}\approx
\frac{\|\mathbf{Z}\|_{F}}{\sqrt{n_t-1}}$$

nt = size(z,2);
Znorm = norm(z,'fro')/sqrt(nt-1);

if ~isempty(outdof)
    if isnumeric(outdof)
        Zout = z(outdof,:);
        noutdof = numel(outdof);
    else
        Zout = outdof(z);
        noutdof = size(Zout,1);
    end
    Aout = zeros(1, noutdof);
    for k=1:numel(outdof)
        Aout(k) = norm(Zout(k,:),'inf');
    end
    ZoutNorm = norm(Zout,'fro')/sqrt(nt-1);
    varargout{1} = ZoutNorm;
else
    Zout = [];
    Aout = [];
end
        
end