/@ess/ss.m (5f70f1ec3330c58820c601bea8aec6208a954105) (3838 bytes) (mode 100644) (type blob)

function ssobj = ss(obj,varargin)
% ssobj = ss(essobj)
% ssobj = ss(essobj, method)
%
% Convert ess object to pure ss object.
%
% The method argument can be one of the following:
%
% - 'measured' (default): The noise input is discarded. This is
%    equivalent to SS(A,B,C,D)
%
% - 'augmented': Noise input is appended to deterministic input. This
%    is equivalent to SS(A,[B,L,0],C,[D,0,1]), where the 1 is a unit
%    gain input for measurement noise, while the 0's are appropriate
%    paddings.
%
%    Note that NO scaling is applied to L. Noise series which are
%    used as inputs therefore need to have correct (possibly non-unit)
%    variances! This is in contrast to idParametric/ss which scales
%    input matrices with sqrt(NoiseVariance).
%
% - 'noise': Only the noise input is kept, while the deterministic
%    input is droped. This is equivalent to SS(A,[L,0],[0,1]) (see
%    above).
%
% See also IDPARAMETRIC/SS

% TODO
% * Should the scaling be changed?
%   - non-zero correlations must be preserved!!
% * Display method has to be changed if ess ever gets a 'NoiseName' field!!

    METHOD = 'measured';

    for ii = 1:(nargin - 1)
        switch varargin{ii}
          case 'noise', METHOD = 'noise';
          case 'augmented', METHOD = 'augmented';
          otherwise warning('unknown method');
        end
    end

    % read ss properties into struct
    % this automatically implements 'measured'
    props = struct();
    names = properties(ss);
        for ii=1:length(names)
            props.(names{ii})=obj.(names{ii});
        end
        % system dimensions
        % sn = dimension state
        % on = dimension measurement
        % dn = dimension deterministic input
        % pn = dimension process noise
        [on sn] = size(obj.c);
        dn = size(obj.b,2);
        pn = size(obj.l,2);

        % create cell with noise names
        % note: this has to be changed if ess ever gets a 'NoiseName' field!!
        wlabels = arrayfun(@(x) sprintf('w%d',x),1:size(obj.l,2),'UniformOutput',false);
        vlabels = arrayfun(@(x) sprintf('v%d',x),1:on,'UniformOutput',false);
        % set properties in temporary struct
        % append noise input as deterministic input
        %
        % this has to be done in this way to circumvent the dimensionality
        % checks of ss objects
        switch METHOD
          case 'augmented'
            % append process noise input to deterministic input
            props.b = [props.b,obj.l,zeros(sn,on)];
            % append unit gain measurement noise input AFTER process noise input
            props.d = [props.d,zeros(on,size(obj.l,2)),eye(on)];
            % pad InputName such that length fits new input length
            props.InputName = {props.InputName{:},wlabels{:},vlabels{:}};
          case 'noise'
            % replace deterministic input with noise input
            props.b = [obj.l,zeros(sn,on)];
            props.d = [zeros(on,size(obj.l,2)),eye(on)];
            % pad InputName such that length fits new input length
            props.InputName = {wlabels{:},vlabels{:}};
          otherwise                     % do nothing
        end

        % write properties back into new ss object
        ssobj = ss();
        for ii = 1:length(names)
            ssobj.(names{ii}) = props.(names{ii});
        end

        % set input group names
        % (this overwrites existing values)
        switch METHOD
          case 'measured'
            ssobj.InputGroup.KnownInput = 1:dn;
          case 'augmented'
            ssobj.InputGroup.KnownInput = 1:dn;
            ssobj.InputGroup.ProcessNoise = dn+1:dn+pn;
            ssobj.InputGroup.MeasurementNoise = dn+pn+1:dn+pn+on;
          case 'noise'
            ssobj.InputGroup.ProcessNoise = 1:pn;
            ssobj.InputGroup.MeasurementNoise = pn+1:pn+on;
        end


Mode Type Size Ref File
100644 blob 8 8661a74e3bb9b03feca04e50d8efe2bef1b850cb .gitattributes
100644 blob 120 cca258db030626db0c4ac1e890cc16eaf252108c .gitignore
040000 tree - 5f3320287cc52b8fe00f30aaeb720f4ead041eb4 @dac
040000 tree - 3742083c966615ed5cb083eb2a19af4d29d42016 @dadac
040000 tree - 9de17412e8ee68e0fe653eeab1b4774a97a895ea @daddc
040000 tree - c3e526da8c47c7fad5294dee214bb0befb2c3fd1 @ess
100644 blob 9760 35b8f790dee4b23110889efba1f24197fc8f536e README.org
100644 blob 3791 813c5e3910317ab2a1458fad0ffd4afaf8ae50cd README.txt
040000 tree - d28f3f04e3e1eb132dc3e89683f495183012b3b6 data_analysis
040000 tree - eb34931ccd81545efcd60c9adb209065dadc5cd0 kalmanfilter
040000 tree - 3043e60b6fbf9136eace3a65fb24c42c544c86ae misc
040000 tree - 1dddc962b8ecbf37a997ca89cad3711b3d69cfd8 models
040000 tree - a96e7cf3890bbe98927df60dcb1f69a8fa4382fd simulations
100644 blob 621 50214a520c35e3f600fe40789181c708967fcb88 startup.m
040000 tree - 86ca0a9d5bf2ede090afb7139b2f2d9d7a0af1db statisticstests
040000 tree - 3cf29c8555988b4e2f59b54f29a64facc143697a stochasticintegration
040000 tree - 7db02f73f80ee728bfacb21b724ba422ed617df9 tests
040000 tree - d4417b0e6958152f3591a8335f126bf84ff5ae5d thirdparty
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/gutc61/Membrane

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/gutc61/Membrane

Clone this repository using git:
git clone git://git.rocketgit.com/user/gutc61/Membrane

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main