MIMO_ML_AddSelectColumns

PURPOSE ^

SYNOPSIS ^

function TheJacob = MIMO_ML_AddSelectColumns(TheJacob, TheSel, ModelVar);

DESCRIPTION ^

 function TheJacob = MIMO_ML_AddSelectColumns(TheJacob, TheSel, ModelVar);

    Imposes the common parameter structure (reciprocal) by
    adding the appropriate columns, and selects the columns of the 
    Jacobian matrix corresponding to the parameters to be estimated


    Output parameter

        TheJacob            =    Jacobian matrix after imposing the common parameter structure,
                                all other parameters (except those who are zero) are free
                                size: ny * number of freq. x number of parameters


    Input parameter

        TheJacob            =    Jacobian matrix before imposing the common parameter structure:
                                all parameters (even those who are zero) are free
                                size: ny * F x ntheta 

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

        ModelVar            =    contains the information about the model to be identified
                                    ModelVar.Transient        =    1 then the initial conditions of the plant 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
                                                                    'BJ':        Box-Jenkins
                                                                    'OE':        output error (plant model only)
                                                                    'ARMA':        autoregressive moving average (noise model only)
                                                                    'ARMAX':    autoregressive moving average with exogenous input
                                    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 TheJacob = MIMO_ML_AddSelectColumns(TheJacob, TheSel, ModelVar);
0002 %
0003 % function TheJacob = MIMO_ML_AddSelectColumns(TheJacob, TheSel, ModelVar);
0004 %
0005 %    Imposes the common parameter structure (reciprocal) by
0006 %    adding the appropriate columns, and selects the columns of the
0007 %    Jacobian matrix corresponding to the parameters to be estimated
0008 %
0009 %
0010 %    Output parameter
0011 %
0012 %        TheJacob            =    Jacobian matrix after imposing the common parameter structure,
0013 %                                all other parameters (except those who are zero) are free
0014 %                                size: ny * number of freq. x number of parameters
0015 %
0016 %
0017 %    Input parameter
0018 %
0019 %        TheJacob            =    Jacobian matrix before imposing the common parameter structure:
0020 %                                all parameters (even those who are zero) are free
0021 %                                size: ny * F x ntheta
0022 %
0023 %        TheSel                =    structure with fields 'A', 'B', 'Ig'
0024 %                                    TheSel = struct('A',[],'B',[], 'Ig', [])
0025 %                                    TheSel.A = 1 x (OrderA+1)
0026 %                                        TheSel.A(r) = 1 if coeff. a(r-1) is unknown
0027 %                                        Sel.A(r) = 0 if coeff. a(r-1) = 0
0028 %                                    TheSel.B = ny x nu x (OrderB+1)
0029 %                                        TheSel.B(i,j,r) = 1 if coeff. b(i,j,r-1) is unknown
0030 %                                        TheSel.B(i,j,r) = 0 if coeff. b(i,j,r-1) = 0
0031 %                                    TheSel.Ig = ny x (OrderIg+1)
0032 %                                        TheSel.Ig(i,r) = 1 if coeff. ig(i,r-1) is unknown
0033 %                                        TheSel.Ig(i,r) = 0 if coeff. ig(i,r-1) = 0
0034 %
0035 %        ModelVar            =    contains the information about the model to be identified
0036 %                                    ModelVar.Transient        =    1 then the initial conditions of the plant are estimated
0037 %                                    ModelVar.PlantPlane        =    plane of the plant model
0038 %                                                                    's':    continuous-time;
0039 %                                                                    'w':    sqrt(s)-domain
0040 %                                                                    'z':    discrete-time;
0041 %                                                                    '':        plane not defined
0042 %                                    ModelVar.Struct            =    model structure
0043 %                                                                    'BJ':        Box-Jenkins
0044 %                                                                    'OE':        output error (plant model only)
0045 %                                                                    'ARMA':        autoregressive moving average (noise model only)
0046 %                                                                    'ARMAX':    autoregressive moving average with exogenous input
0047 %                                    ModelVar.RecipPlant        =    1 if plant model is reciprocal: G(i,j) = G(j,i)
0048 %                                    ModelVar.nu                =    number of inputs
0049 %                                    ModelVar.ny                =    number of outputs
0050 %                                    ModelVar.na                =    order polynomial A
0051 %                                    ModelVar.nb                =    order matrix polynomial B
0052 %                                    ModelVar.nig            =    order vector polynomial Ig
0053 %
0054 %
0055 % Copyright (c) Rik Pintelon, Vrije Universiteit Brussel - dept. ELEC, November 2009
0056 % All rights reserved.
0057 % Software can be used freely for non-commercial applications only.
0058 %
0059 
0060 % order polynomials
0061 na = ModelVar.na;
0062 nb = ModelVar.nb;
0063 nig = ModelVar.nig;
0064 
0065 % inputs and outputs
0066 nu = ModelVar.nu;
0067 ny = ModelVar.ny;
0068 
0069 
0070 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0071 % summing columns Jacobian matrix in case of a reciprocal plant model structure %
0072 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0073 
0074 if ModelVar.RecipPlant
0075     
0076     start = (na+1) + 1;                                % ofset for coefficients A polynomial
0077 
0078     for jj = 1:nu                                    % column index
0079         for ii = 1+jj:ny                            % row index
0080             lij = ii + ny*(jj-1);                    % block position coefficients b(ii,jj) polynomial
0081             lji = jj + ny*(ii-1);                    % block position coefficients b(jj,ii) polynomial
0082 
0083             if lji <= nu*ny                            % test for rectangular matrices
0084                 startij = start + (lij-1)*(nb+1);
0085                 stopij = start + lij*(nb+1) - 1 ;
0086                 startji = start + (lji-1)*(nb+1);
0087                 stopji = start + lji*(nb+1) - 1 ;
0088                 TheJacob(:, startij:stopij) = TheJacob(:, startij:stopij) + TheJacob(:, startji:stopji);
0089             end % if
0090 
0091         end % ii
0092     end % jj
0093 
0094 end % if reciprocal plant model
0095 
0096 
0097 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0098 % create row vector that selects the columns of the Jacobian %
0099 % matrix corresponding to the parameters to be estimated      %
0100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0101 
0102 % A polynomial
0103 Select = TheSel.A;
0104 
0105 % B ny x nu matrix polynomial
0106 % for jj = 1:nu
0107 %     for ii = 1:ny
0108 %         Select = [Select, squeeze(TheSel.B(ii,jj,:)).'];
0109 %     end % ii
0110 % end % jj
0111 SelB = permute(TheSel.B,[3, 1, 2]);     %  reason: vec(B) is calculated as: vecB = permute(B, [3, 1, 2]); vecB = vecB(:);
0112 Select = [Select, SelB(:).'];
0113 
0114 % Ig ny x 1 vector polynomial
0115 % for ii = 1:ny
0116 %     Select = [Select, TheSel.Ig(ii,:)];
0117 % end % ii
0118 SelIg = TheSel.Ig.';
0119 Select = [Select, SelIg(:).'];
0120 
0121 
0122 %%%%%%%%%%%%%%%%%%%%%%%%%%%
0123 % selection columns Jacob %
0124 %%%%%%%%%%%%%%%%%%%%%%%%%%%
0125 
0126 TheJacob = TheJacob(:, Select == 1);

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