MIMO_LS_NewtonGaussStep

PURPOSE ^

SYNOPSIS ^

function [Theta, smax, smin] = MIMO_LS_NewtonGaussStep(data, x, xMat, Sel, ModelVar);

DESCRIPTION ^

    [Theta, smax, smin] = MIMO_LS_NewtonGaussStep(data, x, xMat, Sel, ModelVar)


    Output parameters

        Theta        =    new estimate plant, noise, and initial conditions parameters
                        structure with fields 'A', 'B', 'Ig'
                            Theta = struct('A',[],'B',[], 'Ig', [])
                            Theta.A = 1 x (OrderA+1)
                                Theta.A(r) = coefficient a(r-1) of Omega^(r-1) 
                            Theta.B = ny x nu x (OrderB+1)
                                Theta.B(i,j,r) = coefficient b(i,j,r-1) of Omega^(r-1)
                            Theta.Ig = ny x (OrderIg+1)
                                Theta.Ig(i,r) = coefficient ig(i,r-1) of Omega^(r-1) 
                        Note:    all coefficients (except those for which Sel = 0) are free
                                during the minimization + in each iteration step the following
                                constraints are imposed:
                                    norm([a, vec(b), vec(ig)] = 1

        smax        =    largest singular value of the Jacobian matrix

        smin        =    smallest singular value of the Jacobian matrix


    Input parameters

        data        =    structure containing the non-parametric data required for the identification
                            data.Y          =    output DFT spectra of 1 or nu independent MIMO experiments 
                                                   1 MIMO experiment:   ny x F 
                                                   nu MIMO experiments: ny x nu x F 
                            data.U          =    input DFT spectra of 1 or nu independent MIMO experiments 
                                                   1 MIMO experiment:   nu x F 
                                                   nu MIMO experiments: nu x nu x F 
                            data.freq       =    vector of frequency values (Hz), size: F x 1
                            data.Ts         =    sampling time (s)
                            data.sqrtWinv   =    square root of the inverse weighting matrix 
                                                   1 MIMO experiment:   ny x ny x F 
                                                   nu MIMO experiments: ny x ny x nu x F 
                            data.DC            =    1 if DC present otherwise 0
                            data.Nyquist    =    1 if Nyquist frequency present otherwise 0
                           data.NumberExp  =   number of independent MIMO experiments (1 or nu) 

        x            =    structure containing (jwk) or (zk^-1) values
                            x.Plant    =    plant model, dimension: F x 1 

        xMat        =    structure with tables of powers of (jwk)^r or (zk^-r)
                            xMat.Plant        =    plant model, dimension: F x max order

        Sel            =    structure with fields 'A', 'B', 'Ig'
                            Sel = struct('A',[],'B',[], 'Ig', [])
                            Sel.A = 1 x (OrderA+1)
                                Sel.A(r) = 1 if coeff. a(r-1) is unknown
                                Sel.A(r) = 0 if coeff. a(r-1) = 0
                            Sel.B = ny x nu x (OrderB+1)
                                Sel.B(i,j,r) = 1 if coeff. b(i,j,r-1) is unknown
                                Sel.B(i,j,r) = 0 if coeff. b(i,j,r-1) = 0
                            Sel.Ig = ny x (OrderIg+1)
                                Sel.Ig(i,r) = 1 if coeff. ig(i,r-1) is unknown
                                Sel.Ig(i,r) = 0 if coeff. ig(i,r-1) = 0

        ModelVar        =    contains the information about the model to be identified
                            structure with fields 'Transient', 'ThePlane', 'TheModel', 'Reciprocal', ...
                                ModelVar.Transient        =    1 then the initial conditions of the plant and/or noise are estimated
                                ModelVar.PlantPlane        =    plane of the plant model
                                                                's':    continuous-time;
                                                                'w':    sqrt(s)-domain
                                                                'z':    discrete-time;
                                                                '':        plane not defined
                                ModelVar.Struct            =    model structure
                                                               'EIV':  errors-in-variables (noisy input-output data)
                                                               'OE':    generalised output error (known input, noisy output)
                                ModelVar.RecipPlant        =    1 if plant model is reciprocal: G(i,j) = G(j,i)
                                ModelVar.nu                =    number of inputs
                                ModelVar.ny                =     number of outputs
                                ModelVar.na                =    order polynomial A
                                ModelVar.nb                =     order matrix polynomial B
                                ModelVar.nig            =    order vector polynomial Ig


 Copyright (c) Rik Pintelon, Vrije Universiteit Brussel - dept. ELEC, November 2009
 All rights reserved.
 Software can be used freely for non-commercial applications only.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Theta, smax, smin] = MIMO_LS_NewtonGaussStep(data, x, xMat, Sel, ModelVar);
0002 %
0003 %    [Theta, smax, smin] = MIMO_LS_NewtonGaussStep(data, x, xMat, Sel, ModelVar)
0004 %
0005 %
0006 %    Output parameters
0007 %
0008 %        Theta        =    new estimate plant, noise, and initial conditions parameters
0009 %                        structure with fields 'A', 'B', 'Ig'
0010 %                            Theta = struct('A',[],'B',[], 'Ig', [])
0011 %                            Theta.A = 1 x (OrderA+1)
0012 %                                Theta.A(r) = coefficient a(r-1) of Omega^(r-1)
0013 %                            Theta.B = ny x nu x (OrderB+1)
0014 %                                Theta.B(i,j,r) = coefficient b(i,j,r-1) of Omega^(r-1)
0015 %                            Theta.Ig = ny x (OrderIg+1)
0016 %                                Theta.Ig(i,r) = coefficient ig(i,r-1) of Omega^(r-1)
0017 %                        Note:    all coefficients (except those for which Sel = 0) are free
0018 %                                during the minimization + in each iteration step the following
0019 %                                constraints are imposed:
0020 %                                    norm([a, vec(b), vec(ig)] = 1
0021 %
0022 %        smax        =    largest singular value of the Jacobian matrix
0023 %
0024 %        smin        =    smallest singular value of the Jacobian matrix
0025 %
0026 %
0027 %    Input parameters
0028 %
0029 %        data        =    structure containing the non-parametric data required for the identification
0030 %                            data.Y          =    output DFT spectra of 1 or nu independent MIMO experiments
0031 %                                                   1 MIMO experiment:   ny x F
0032 %                                                   nu MIMO experiments: ny x nu x F
0033 %                            data.U          =    input DFT spectra of 1 or nu independent MIMO experiments
0034 %                                                   1 MIMO experiment:   nu x F
0035 %                                                   nu MIMO experiments: nu x nu x F
0036 %                            data.freq       =    vector of frequency values (Hz), size: F x 1
0037 %                            data.Ts         =    sampling time (s)
0038 %                            data.sqrtWinv   =    square root of the inverse weighting matrix
0039 %                                                   1 MIMO experiment:   ny x ny x F
0040 %                                                   nu MIMO experiments: ny x ny x nu x F
0041 %                            data.DC            =    1 if DC present otherwise 0
0042 %                            data.Nyquist    =    1 if Nyquist frequency present otherwise 0
0043 %                           data.NumberExp  =   number of independent MIMO experiments (1 or nu)
0044 %
0045 %        x            =    structure containing (jwk) or (zk^-1) values
0046 %                            x.Plant    =    plant model, dimension: F x 1
0047 %
0048 %        xMat        =    structure with tables of powers of (jwk)^r or (zk^-r)
0049 %                            xMat.Plant        =    plant model, dimension: F x max order
0050 %
0051 %        Sel            =    structure with fields 'A', 'B', 'Ig'
0052 %                            Sel = struct('A',[],'B',[], 'Ig', [])
0053 %                            Sel.A = 1 x (OrderA+1)
0054 %                                Sel.A(r) = 1 if coeff. a(r-1) is unknown
0055 %                                Sel.A(r) = 0 if coeff. a(r-1) = 0
0056 %                            Sel.B = ny x nu x (OrderB+1)
0057 %                                Sel.B(i,j,r) = 1 if coeff. b(i,j,r-1) is unknown
0058 %                                Sel.B(i,j,r) = 0 if coeff. b(i,j,r-1) = 0
0059 %                            Sel.Ig = ny x (OrderIg+1)
0060 %                                Sel.Ig(i,r) = 1 if coeff. ig(i,r-1) is unknown
0061 %                                Sel.Ig(i,r) = 0 if coeff. ig(i,r-1) = 0
0062 %
0063 %        ModelVar        =    contains the information about the model to be identified
0064 %                            structure with fields 'Transient', 'ThePlane', 'TheModel', 'Reciprocal', ...
0065 %                                ModelVar.Transient        =    1 then the initial conditions of the plant and/or noise are estimated
0066 %                                ModelVar.PlantPlane        =    plane of the plant model
0067 %                                                                's':    continuous-time;
0068 %                                                                'w':    sqrt(s)-domain
0069 %                                                                'z':    discrete-time;
0070 %                                                                '':        plane not defined
0071 %                                ModelVar.Struct            =    model structure
0072 %                                                               'EIV':  errors-in-variables (noisy input-output data)
0073 %                                                               'OE':    generalised output error (known input, noisy output)
0074 %                                ModelVar.RecipPlant        =    1 if plant model is reciprocal: G(i,j) = G(j,i)
0075 %                                ModelVar.nu                =    number of inputs
0076 %                                ModelVar.ny                =     number of outputs
0077 %                                ModelVar.na                =    order polynomial A
0078 %                                ModelVar.nb                =     order matrix polynomial B
0079 %                                ModelVar.nig            =    order vector polynomial Ig
0080 %
0081 %
0082 % Copyright (c) Rik Pintelon, Vrije Universiteit Brussel - dept. ELEC, November 2009
0083 % All rights reserved.
0084 % Software can be used freely for non-commercial applications only.
0085 %
0086 
0087 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0088 % initialisation of the variables %
0089 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0090 
0091 F = length(data.freq);                          % number of frequencies
0092 NumberExp = data.NumberExp;                     % number of independent MIMO experiments
0093 ny = ModelVar.ny;                               % number of outputs
0094 nu = ModelVar.nu;                               % number of inputs
0095 na = ModelVar.na;                               % order A polynomial
0096 nb = ModelVar.nb;                               % order B matrix polynomial
0097 nig = ModelVar.nig;                             % order Ig vector polynomial
0098 ntheta = (na+1) + (nb+1)*nu*ny + (nig+1)*ny;    % total number of parameters
0099 TheJacob = zeros(NumberExp*ny*F, ntheta);       % the jacobian matrix of all MIMO experiments
0100 dataee = data;                                  % information about 1 MIMO experiment (see below)
0101 dataee.Y = zeros(ny, F);                        % output of 1 MIMO experiment
0102 dataee.U = zeros(nu, F);                        % input of 1 MIMO experiment
0103 dataee.sqrtWinv = zeros(ny, ny, F);             % square root of the inverse weigthing matrix of 1 MIMO experiment
0104 
0105 
0106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0107 % calculate the variation of the free model parameters %
0108 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0109 
0110 for ee = 1:NumberExp
0111     
0112     % data of MIMO experiment no. ee
0113     if NumberExp > 1
0114         dataee.Y(:,:) = data.Y(:,ee,:);
0115         dataee.U(:,:) = data.U(:,ee,:);
0116         dataee.sqrtWinv(:,:,:) = data.sqrtWinv(:,:,ee,:);
0117     else % 1 MIMO experiment
0118         dataee.Y(:,:) = data.Y;
0119         dataee.U(:,:) = data.U;
0120         dataee.sqrtWinv(:,:,:) = data.sqrtWinv;
0121     end % if more than 1 MIMO experiment
0122     
0123     % Jacobian matrix of prediction error w.r.t. ALL model parameters
0124     Jacob = MIMO_LS_Jacob(dataee, xMat, ModelVar);
0125 
0126     % put the different frequency contributions on top of each other
0127     % size Jacob in: ny x ntheta x F
0128     % size Jacob out: ny*F x ntheta
0129     Jacob = reshape(permute(Jacob, [1,3,2]), [ny*F, ntheta]);
0130     
0131     % put experiment no. ee in the Jacobian matrix and prediction error vector
0132     SelectRows = [(ee-1)*ny*F+1:ee*ny*F];
0133     TheJacob(SelectRows, :) = Jacob;
0134         
0135 end % ee, number of MIMO experiments
0136 
0137 % impose the common parameter structure and eliminate the excess parameters
0138 % size TheJacob in:  ny*F x ntheta
0139 % size TheJacob out: ny*F x number of free model parameters
0140 TheJacob = MIMO_ML_AddSelectColumns(TheJacob, Sel, ModelVar);
0141 
0142 % scaling of the columns of the Jacobian matrix to improve the condition number
0143 TheScale = sum(abs(TheJacob.^2), 1).^0.5;
0144 IndexZeroes = find(TheScale == 0);
0145 TheScale(IndexZeroes) = 1;
0146 TheJacob = TheJacob ./ repmat(TheScale, [size(TheJacob, 1), 1]);
0147 
0148 % calculate the TLS solution
0149 [u, ss, v] = svd([real(TheJacob); imag(TheJacob)], 0);
0150 smax = ss(1,1);
0151 smin = ss(end-1,end-1);
0152 DeltaParam = v(:,end);
0153 
0154 % denormalisation parameter variation
0155 DeltaParam = DeltaParam ./ TheScale.';
0156 
0157 
0158 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0159 % extract the plant model parameters from DeltaParam %
0160 % order in DeltaParam: a, b, ig                      %
0161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0162 
0163 ny = ModelVar.ny;
0164 nu = ModelVar.nu;
0165 na = ModelVar.na;
0166 nb = ModelVar.nb;
0167 nig = ModelVar.nig;
0168 OldTheta.A = zeros(1, na + 1);
0169 OldTheta.B = zeros(ny, nu, nb + 1);
0170 OldTheta.Ig = zeros(ny, nig + 1);
0171 
0172 Theta = MIMO_ML_ExtractParam(DeltaParam, OldTheta, Sel);    
0173 
0174 
0175 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0176 % Impose constraints on updated parameters %
0177 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0178 
0179 Theta = MIMO_ML_Constrain(Theta, ModelVar);
0180

Generated on Thu 07-Jun-2012 11:58:58 by m2html © 2005