MIMO_ML_CRtf

PURPOSE ^

SYNOPSIS ^

function CRbound = MIMO_ML_CRtf(CRbound, SqrtCRtheta, PolyTrans, Deriv, Sel, ModelVar);

DESCRIPTION ^

 function CRbound = MIMO_ML_CRtf(CRbound, SqrtCRtheta, PolyTrans, Deriv, Sel, ModelVar);


   Output parameter

        CRbound        =    see input parameter; the following fields are added 'vecG' and 'vecH' which are the
                           Cramer-Rao lower bounds of the plant (vec(G)) transfer function matrix 
                            CRbound.vecG = ny*nu x ny*nu x F
                                CRbound.vecG(i,j) = covariance between plant transfer functions vecG(i) and vecG(j) 
                            CRbound.G = ny x nu x F
                                CRbound.G(i,j,r) = variance G(i,j,r)


   Input parameters

        CRbound        =    Cramer-Rao bound of the estimated model parameters, the estimated plant model, and the estimated noise model
                        structure with fields 'A', 'vecB', 'Theta'
                            CRbound = struct('A', [], 'vecB', [], 'Theta', [])
                            CRbound.A = FreeParam.A x FreeParam.A
                                CRbound.A(i,j) = covariance between free coefficients a(i-1) and a(j-1) 
                            CRbound.AvecB = FreeParam.A x FreeParam.B
                                CRbound.AvecB(i,j) = covariance between free coefficients a(i-1) and vecB(j) 
                            CRbound.vecB = FreeParam.B x FreeParam.B
                                CRbound.vecB(i,j) = covariance between free parameters vecB(i) and vecB(j)
                            CRbound.all = dim(Theta) x dim(Theta), where dim(Theta) = FreeParam.A + FreeParam.B + FreeParam.C + FreeParam.D
                                CRbound.all(i,j) = covariance between free parameters Theta(i) and Theta(j)
                            Notes:
                               - in s-, sqrt(s) domains the CR-bound of the normalised parameters is calculated
                               - the (normalised) model parameters satisfy the following constraints
                                   z-domain:               a(0)      = 1
                                   s-, sqrt(s)-domains:    a(OrderA)  = 1

       SqrtCRtheta =   square root of CRbound.all to guarantee a numerical stable calculation of CRbound.vecG, ...
                       CRbound.all = SqrtCRtheta * SqrtCRtheta.' 

        PolyTrans    =    structure containing the polynomials and transfer functions evaluated in x
                            PolyTrans.A        =    denominator polynomial plant transfer function evaluated in x.Plant, size 1 x F 
                            PolyTrans.G        =    plant transfer matrix evaluated in x.Plant, size ny x nu x F 
                            PolyTrans.Tg    =    plant transient term evaluated in x.Plant, size ny x F 

        Deriv        =    structure containing the derivative of vec(G), vec(G') w.r.t. all the plant model parameters a, b
                            Deriv.vecGa        =    derivative vec(G) w.r.t. a; size ny*nu x (na+1) x F 
                            Deriv.vecGb        =    derivative vec(G) w.r.t. b;    size ny*nu x ny*nu*(nb+1) x F
                            Deriv.vecGHa    =    derivative vec(G') w.r.t. a; size ny*nu x (na+1) x F
                            Deriv.vecGHb    =    derivative vec(G') w.r.t. b; size ny*nu x ny*nu*(nb+1) x F

        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 the following fields
                            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


 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 CRbound = MIMO_ML_CRtf(CRbound, SqrtCRtheta, PolyTrans, Deriv, Sel, ModelVar);
0002 %
0003 % function CRbound = MIMO_ML_CRtf(CRbound, SqrtCRtheta, PolyTrans, Deriv, Sel, ModelVar);
0004 %
0005 %
0006 %   Output parameter
0007 %
0008 %        CRbound        =    see input parameter; the following fields are added 'vecG' and 'vecH' which are the
0009 %                           Cramer-Rao lower bounds of the plant (vec(G)) transfer function matrix
0010 %                            CRbound.vecG = ny*nu x ny*nu x F
0011 %                                CRbound.vecG(i,j) = covariance between plant transfer functions vecG(i) and vecG(j)
0012 %                            CRbound.G = ny x nu x F
0013 %                                CRbound.G(i,j,r) = variance G(i,j,r)
0014 %
0015 %
0016 %   Input parameters
0017 %
0018 %        CRbound        =    Cramer-Rao bound of the estimated model parameters, the estimated plant model, and the estimated noise model
0019 %                        structure with fields 'A', 'vecB', 'Theta'
0020 %                            CRbound = struct('A', [], 'vecB', [], 'Theta', [])
0021 %                            CRbound.A = FreeParam.A x FreeParam.A
0022 %                                CRbound.A(i,j) = covariance between free coefficients a(i-1) and a(j-1)
0023 %                            CRbound.AvecB = FreeParam.A x FreeParam.B
0024 %                                CRbound.AvecB(i,j) = covariance between free coefficients a(i-1) and vecB(j)
0025 %                            CRbound.vecB = FreeParam.B x FreeParam.B
0026 %                                CRbound.vecB(i,j) = covariance between free parameters vecB(i) and vecB(j)
0027 %                            CRbound.all = dim(Theta) x dim(Theta), where dim(Theta) = FreeParam.A + FreeParam.B + FreeParam.C + FreeParam.D
0028 %                                CRbound.all(i,j) = covariance between free parameters Theta(i) and Theta(j)
0029 %                            Notes:
0030 %                               - in s-, sqrt(s) domains the CR-bound of the normalised parameters is calculated
0031 %                               - the (normalised) model parameters satisfy the following constraints
0032 %                                   z-domain:               a(0)      = 1
0033 %                                   s-, sqrt(s)-domains:    a(OrderA)  = 1
0034 %
0035 %       SqrtCRtheta =   square root of CRbound.all to guarantee a numerical stable calculation of CRbound.vecG, ...
0036 %                       CRbound.all = SqrtCRtheta * SqrtCRtheta.'
0037 %
0038 %        PolyTrans    =    structure containing the polynomials and transfer functions evaluated in x
0039 %                            PolyTrans.A        =    denominator polynomial plant transfer function evaluated in x.Plant, size 1 x F
0040 %                            PolyTrans.G        =    plant transfer matrix evaluated in x.Plant, size ny x nu x F
0041 %                            PolyTrans.Tg    =    plant transient term evaluated in x.Plant, size ny x F
0042 %
0043 %        Deriv        =    structure containing the derivative of vec(G), vec(G') w.r.t. all the plant model parameters a, b
0044 %                            Deriv.vecGa        =    derivative vec(G) w.r.t. a; size ny*nu x (na+1) x F
0045 %                            Deriv.vecGb        =    derivative vec(G) w.r.t. b;    size ny*nu x ny*nu*(nb+1) x F
0046 %                            Deriv.vecGHa    =    derivative vec(G') w.r.t. a; size ny*nu x (na+1) x F
0047 %                            Deriv.vecGHb    =    derivative vec(G') w.r.t. b; size ny*nu x ny*nu*(nb+1) x F
0048 %
0049 %        Sel            =    structure with fields 'A', 'B', 'Ig'
0050 %                            Sel = struct('A',[],'B',[], 'Ig', [])
0051 %                            Sel.A = 1 x (OrderA+1)
0052 %                                Sel.A(r) = 1 if coeff. a(r-1) is unknown
0053 %                                Sel.A(r) = 0 if coeff. a(r-1) = 0
0054 %                            Sel.B = ny x nu x (OrderB+1)
0055 %                                Sel.B(i,j,r) = 1 if coeff. b(i,j,r-1) is unknown
0056 %                                Sel.B(i,j,r) = 0 if coeff. b(i,j,r-1) = 0
0057 %                            Sel.Ig = ny x (OrderIg+1)
0058 %                                Sel.Ig(i,r) = 1 if coeff. ig(i,r-1) is unknown
0059 %                                Sel.Ig(i,r) = 0 if coeff. ig(i,r-1) = 0
0060 %
0061 %        ModelVar    =    contains the information about the model to be identified structure with the following fields
0062 %                            ModelVar.Transient        =    1 then the initial conditions of the plant and/or noise are estimated
0063 %                            ModelVar.PlantPlane        =    plane of the plant model
0064 %                                                            's':    continuous-time
0065 %                                                            'w':    sqrt(s)-domain
0066 %                                                            'z':    discrete-time
0067 %                                                            '':        plane not defined
0068 %                            ModelVar.Struct            =    model structure
0069 %                                                           'EIV':    errors-in-variables (noisy input-output data)
0070 %                                                           'OE':    generalised output error (known input, noisy output)
0071 %                            ModelVar.RecipPlant        =    1 if plant model is reciprocal: G(i,j) = G(j,i)
0072 %                            ModelVar.nu                =    number of inputs
0073 %                            ModelVar.ny                =     number of outputs
0074 %                            ModelVar.na                =    order polynomial A
0075 %                            ModelVar.nb                =     order matrix polynomial B
0076 %
0077 %
0078 % Copyright (c) Rik Pintelon, Vrije Universiteit Brussel - dept. ELEC, November 2009
0079 % All rights reserved.
0080 % Software can be used freely for non-commercial applications only.
0081 %
0082 
0083 
0084 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0085 % Covariance matrix model parameters:                                                %
0086 %   1. collect the derivatives of vec(G) w.r.t. theta into one matrix                %
0087 %   2. put the derivative matrices in the following form:                            %
0088 %       nu*ny x ntheta x F => nu*ny*F x ntheta for the derivatives of vec(G)         %
0089 %   3. impose the common parameter structure and eliminate excess parameters         %
0090 %   4. put the derivative matrices back in their original form:                      %
0091 %       nu*ny*F x nfreetheta => nu*ny x nfreetheta x F for the derivatives of vec(G) %
0092 %   5. calculate the covariance matrices for all frequencies                         %
0093 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0094 
0095 nu = ModelVar.nu;
0096 ny = ModelVar.ny;
0097 na = ModelVar.na;
0098 nb = ModelVar.nb;
0099 nig = ModelVar.nig;
0100 ntheta = (na+1) + (nb+1)*nu*ny + (nig+1)*ny; % total number of model parameters
0101 F = size(PolyTrans.G, 3);
0102 
0103 % 1. collect the derivatives of vec(G) w.r.t. ALL model parameters (without constraints) into one matrix
0104 DerivVecG = [Deriv.vecGa, Deriv.vecGb, zeros(nu*ny, (nig+1)*ny, F)];
0105 
0106 % 2. reshape the derivative matrices
0107 %    the number of columns of the derivative matrices equals the number
0108 %    of ALL model parameters (without constraints)
0109 DerivVecG = reshape(permute(DerivVecG, [1, 3, 2]), [nu*ny*F, ntheta]);
0110 
0111 % 3. impose the common parameter structure and eliminate the excess parameters
0112 %    the number of columns of the derivative matrices equals then the number
0113 %    of FREE model parameters
0114 DerivVecG = MIMO_ML_AddSelectColumns(DerivVecG, Sel, ModelVar);
0115 
0116 % 4. reshape the derivative matrices to their original form
0117 FreeParam.Theta = size(DerivVecG, 2);
0118 DerivVecG = permute(reshape(DerivVecG, [nu*ny, F, FreeParam.Theta]), [1, 3, 2]);
0119 
0120 % 5. calculation of the covariance matrices of the plant transfer function
0121 CRbound.vecG = zeros(nu*ny, nu*ny, F);
0122 CRbound.G = zeros(ny, nu, F);
0123 for kk = 1:F
0124     XX = DerivVecG(:, :, kk) * SqrtCRtheta;
0125     CRbound.vecG(:, :, kk) = XX * XX';
0126     CRbound.G(:, :, kk) = reshape(diag(CRbound.vecG(:, :, kk)), [ny, nu]);
0127 end % kk
0128

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