MIMO_WTLS

PURPOSE ^

SYNOPSIS ^

function [Theta, smax, smin, wscale] = MIMO_WTLS(data, Sel, ModelVar);

DESCRIPTION ^

       (Weighted) total least squares estimate plant model parameters from noisy
       input-output data:

                   sum (A(f)*Y(f) - B(f)*U(f))^H * W(f)^(-1) * (A(f)*Y(f) - B(f)*U(f))
                    f
       The following cases can be handled:

           1. 1 MIMO experiment with random excitations; or the concatenation of several data records 
              (see the ArbLocalPolyAnal function).  
           2. 1 MIMO experiment with periodic excitations
              (see the FastLocalPolyAnal function).  
           3. nexp >=1 MIMO experiments with periodic excitations
              (see the RobustLocalPolyAnal function for the case nu = nexp).  


 [Theta, smax, smin, wscale] = MIMO_WTLS(data, Sel, ModelVar);

                    
                Stochastic framework: errors-in-variables
                    Y = B/A U0 + Ig/A + NY
                   U = U0 + NU

                System with nu inputs and ny outputs
                    Y:                    ny x 1 observed output
                    U:                    nu x 1 observed input
                    NY:                    ny x 1 output noise
                    NU:                    nu x 1 input noise

                Model class: common denominator model
                    G = B/A:            ny x nu plant transfer function
                    Tg = Ig/A:            ny x 1 plant transient term
                    A:                    polynomial of order OrderA
                    B:                    ny x nu matrix polynomial of order OrderB
                    Ig:                    ny x 1 vector polynomial of order OrderIg

                Coefficients polynomials in raising powers of Omega, where
                    s-domain            Omega = j*2*pi*freq
                    sqrt(s)-domain        Omega = sqrt(j*2*pi*freq)
                    z-domain            Omega = exp(-j*2*pi*freq*Ts)

       Reference:

                   Pintelon R., P. Guillaume, G. Vandersteen and Y. Rolain (1998). Analyses, development and applications of TLS 
                   algorithms in frequency-Domain System Identification, SIAM J. Matrix Anal. Appl., vol. 19, no. 4, pp. 983-1004.                


    Output parameters

        Theta                =    estimated value 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

        wscale                =    angular frequency scaling


    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 
                                                       nexp MIMO experiments: ny x nexp x F with nexp >= 1 
                                    data.U        =    input DFT spectra of 1 or nu independent MIMO experiments 
                                                       1 MIMO experiment:   nu x F 
                                                       nexp MIMO experiments: nu x nu x F with nexp >= 1 
                                    data.freq    =    vector of frequency values (Hz), size: F x 1 or 1 x F 
                                    data.Ts        =    sampling time (s)
                                    data.W        =    frequency weighing of the residuals in the least squares fit 
                                                       1 MIMO experiment:   ny x ny x F 
                                                       nexp MIMO experiments: ny x ny x nexp x F with nexp >= 1 

        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', 'RecipPlant' 
                                    ModelVar = struct('Transient', [], 'PlantPlane', [], 'NoisePlane', [], 'Struct', [], 'RecipPlant', [])
                                    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.RecipPlant        =    1 if plant model is reciprocal: G(i,j) = G(j,i) 


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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Theta, smax, smin, wscale] = MIMO_WTLS(data, Sel, ModelVar);
0002 %
0003 %       (Weighted) total least squares estimate plant model parameters from noisy
0004 %       input-output data:
0005 %
0006 %                   sum (A(f)*Y(f) - B(f)*U(f))^H * W(f)^(-1) * (A(f)*Y(f) - B(f)*U(f))
0007 %                    f
0008 %       The following cases can be handled:
0009 %
0010 %           1. 1 MIMO experiment with random excitations; or the concatenation of several data records
0011 %              (see the ArbLocalPolyAnal function).
0012 %           2. 1 MIMO experiment with periodic excitations
0013 %              (see the FastLocalPolyAnal function).
0014 %           3. nexp >=1 MIMO experiments with periodic excitations
0015 %              (see the RobustLocalPolyAnal function for the case nu = nexp).
0016 %
0017 %
0018 % [Theta, smax, smin, wscale] = MIMO_WTLS(data, Sel, ModelVar);
0019 %
0020 %
0021 %                Stochastic framework: errors-in-variables
0022 %                    Y = B/A U0 + Ig/A + NY
0023 %                   U = U0 + NU
0024 %
0025 %                System with nu inputs and ny outputs
0026 %                    Y:                    ny x 1 observed output
0027 %                    U:                    nu x 1 observed input
0028 %                    NY:                    ny x 1 output noise
0029 %                    NU:                    nu x 1 input noise
0030 %
0031 %                Model class: common denominator model
0032 %                    G = B/A:            ny x nu plant transfer function
0033 %                    Tg = Ig/A:            ny x 1 plant transient term
0034 %                    A:                    polynomial of order OrderA
0035 %                    B:                    ny x nu matrix polynomial of order OrderB
0036 %                    Ig:                    ny x 1 vector polynomial of order OrderIg
0037 %
0038 %                Coefficients polynomials in raising powers of Omega, where
0039 %                    s-domain            Omega = j*2*pi*freq
0040 %                    sqrt(s)-domain        Omega = sqrt(j*2*pi*freq)
0041 %                    z-domain            Omega = exp(-j*2*pi*freq*Ts)
0042 %
0043 %       Reference:
0044 %
0045 %                   Pintelon R., P. Guillaume, G. Vandersteen and Y. Rolain (1998). Analyses, development and applications of TLS
0046 %                   algorithms in frequency-Domain System Identification, SIAM J. Matrix Anal. Appl., vol. 19, no. 4, pp. 983-1004.
0047 %
0048 %
0049 %    Output parameters
0050 %
0051 %        Theta                =    estimated value plant, noise, and initial conditions parameters
0052 %                                structure with fields 'A', 'B', 'Ig'
0053 %                                    Theta = struct('A',[],'B',[], 'Ig', [])
0054 %                                    Theta.A = 1 x (OrderA+1)
0055 %                                        Theta.A(r) = coefficient a(r-1) of Omega^(r-1)
0056 %                                    Theta.B = ny x nu x (OrderB+1)
0057 %                                        Theta.B(i,j,r) = coefficient b(i,j,r-1) of Omega^(r-1)
0058 %                                    Theta.Ig = ny x (OrderIg+1)
0059 %                                        Theta.Ig(i,r) = coefficient ig(i,r-1) of Omega^(r-1)
0060 %                                Note:    all coefficients (except those for which Sel = 0) are free
0061 %                                        during the minimization + in each iteration step the following
0062 %                                        constraints are imposed:
0063 %                                            norm([a, vec(b), vec(ig)] = 1
0064 %
0065 %        smax                =    largest singular value of the Jacobian matrix
0066 %
0067 %        smin                =    smallest singular value of the Jacobian matrix
0068 %
0069 %        wscale                =    angular frequency scaling
0070 %
0071 %
0072 %    Input parameters
0073 %
0074 %        data                =    structure containing the non-parametric data required for the identification
0075 %                                    data.Y        =    output DFT spectra of 1 or nu independent MIMO experiments
0076 %                                                       1 MIMO experiment:   ny x F
0077 %                                                       nexp MIMO experiments: ny x nexp x F with nexp >= 1
0078 %                                    data.U        =    input DFT spectra of 1 or nu independent MIMO experiments
0079 %                                                       1 MIMO experiment:   nu x F
0080 %                                                       nexp MIMO experiments: nu x nu x F with nexp >= 1
0081 %                                    data.freq    =    vector of frequency values (Hz), size: F x 1 or 1 x F
0082 %                                    data.Ts        =    sampling time (s)
0083 %                                    data.W        =    frequency weighing of the residuals in the least squares fit
0084 %                                                       1 MIMO experiment:   ny x ny x F
0085 %                                                       nexp MIMO experiments: ny x ny x nexp x F with nexp >= 1
0086 %
0087 %        Sel                    =    structure with fields 'A', 'B', 'Ig'
0088 %                                    Sel = struct('A',[],'B',[], 'Ig', [])
0089 %                                    Sel.A = 1 x (OrderA+1)
0090 %                                        Sel.A(r) = 1 if coeff. a(r-1) is unknown
0091 %                                        Sel.A(r) = 0 if coeff. a(r-1) = 0
0092 %                                    Sel.B = ny x nu x (OrderB+1)
0093 %                                        Sel.B(i,j,r) = 1 if coeff. b(i,j,r-1) is unknown
0094 %                                        Sel.B(i,j,r) = 0 if coeff. b(i,j,r-1) = 0
0095 %                                    Sel.Ig = ny x (OrderIg+1)
0096 %                                        Sel.Ig(i,r) = 1 if coeff. ig(i,r-1) is unknown
0097 %                                        Sel.Ig(i,r) = 0 if coeff. ig(i,r-1) = 0
0098 %
0099 %        ModelVar            =    contains the information about the model to be identified
0100 %                                structure with fields 'Transient', 'ThePlane', 'TheModel', 'RecipPlant'
0101 %                                    ModelVar = struct('Transient', [], 'PlantPlane', [], 'NoisePlane', [], 'Struct', [], 'RecipPlant', [])
0102 %                                    ModelVar.Transient        =    1 then the initial conditions of the plant and/or noise are estimated
0103 %                                    ModelVar.PlantPlane        =    plane of the plant model
0104 %                                                                    's':    continuous-time;
0105 %                                                                    'w':    sqrt(s)-domain
0106 %                                                                    'z':    discrete-time;
0107 %                                                                    '':        plane not defined
0108 %                                    ModelVar.RecipPlant        =    1 if plant model is reciprocal: G(i,j) = G(j,i)
0109 %
0110 %
0111 % Copyright (c) Rik Pintelon, Vrije Universiteit Brussel - dept. ELEC, 26 November 2009
0112 % All rights reserved.
0113 % Software can be used freely for non-commercial applications only.
0114 % Version 24 October 2011
0115 %
0116 
0117 
0118 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0119 % initialisation of the variables, and compatibility check of the input arguments %
0120 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0121 
0122 % model structure variables
0123 ModelVar.PlantPlane = lower(ModelVar.PlantPlane);
0124 ModelVar.Struct = upper(ModelVar.Struct);
0125 
0126 % add number of inputs and outputs to ModelVar
0127 ModelVar.ny = size(data.Y,1);
0128 ModelVar.nu = size(data.U,1);
0129 ny = ModelVar.ny;
0130 nu = ModelVar.nu;
0131 
0132 % 1. imposes the compatibility of the the free model parameters
0133 %    with the model structure
0134 % 2. puts the order of the polynomials in ModelVar
0135 [Sel, ModelVar] = MIMO_WTLS_ModelCompatibility(Sel, ModelVar);
0136 
0137 % check if DC and Nyquist belong to the frequency set
0138 if data.freq(1) == 0, data.DC = 1; else data.DC = 0; end
0139 if data.freq(end) == 1/(2*data.Ts), data.Nyquist = 1; else data.Nyquist = 0; end 
0140 data.freq = data.freq(:);
0141 
0142 % determine the number of MIMO experiments
0143 NumberDim = length(size(data.U));           % number of matrix dimensions
0144 if NumberDim == 2
0145     data.NumberExp = 1;                     % number of MIMO experiments
0146 elseif NumberDim == 3
0147     data.NumberExp = size(data.U, 2);       % number of MIMO experiments
0148 end % if
0149 
0150 % hermitian symmetric square root inverse output covariance matrix
0151 F = length(data.freq);
0152 try
0153     Weighting = ~isempty(data.W);
0154 catch
0155     Weighting = 0;
0156 end
0157 if Weighting
0158     data.sqrtWinv = zeros(size(data.W));
0159     % relative upper limit under which the singular values are set to zero
0160     % in the pseudo-inverse of the square root of the weighting matrix
0161     delta = 1e-6;  
0162     if data.NumberExp == 1
0163         % pseudo-inverse in case of singular weighting
0164         data.sqrtWinv = Sqrt_Inv(data.W, delta);     
0165     else % more than 1 MIMO experiment
0166         for ee = 1:data.NumberExp
0167             % pseudo-inverse in case of singular weighting
0168             data.sqrtWinv(:,:,ee,:) = Sqrt_Inv(reshape(data.W(:,:,ee,:), [ny,ny,F]), delta);
0169         end % ee, MIMO experiments
0170     end % if 1 MIMO experiment
0171 else
0172     if data.NumberExp == 1
0173         % if empty put eye(ny, ny) for every frequency in data.sqrtWinv
0174         data.sqrtWinv = repmat(eye(ny),[1,1,F]);
0175     else % more than 1 MIMO experiment
0176         % if empty put eye(ny, ny) for every experiment and frequency in data.sqrtWinv
0177         data.sqrtWinv = repmat(eye(ny),[1,1,nu,F]);
0178     end % if 1 MIMO experiment
0179 end  
0180 
0181 % jw, sqrt(jw), or exp(-jwTs) values for plant and noise model
0182 x = struct('Plant', []);
0183 % matrix of powers of x
0184 xMat = struct('Plant', []);
0185 
0186 
0187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0188 % domain of the plant model %
0189 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0190 
0191 % the vector s represents z^-1, s, or sqrt(s) of the plant model
0192 switch ModelVar.PlantPlane
0193     case {'s','w'}
0194         if ModelVar.PlantPlane == 's'
0195             x.Plant = sqrt(-1)*2*pi*data.freq;
0196         elseif ModelVar.PlantPlane == 'w'
0197             x.Plant = (sqrt(-1)*2*pi*data.freq).^(0.5);
0198         end;
0199         wscale = median(abs(x.Plant));
0200         x.Plant = x.Plant/wscale;
0201     case 'z'
0202         x.Plant = exp(-sqrt(-1)*2*pi*data.freq*data.Ts);
0203         wscale = 1;
0204     case ''
0205         x.Plant = ones(size(data.freq));
0206         wscale = 1;
0207     otherwise, disp('Invalid plant plane ...'), return
0208 end
0209 
0210 nmax = max([ModelVar.na, ModelVar.nb, ModelVar.nig]);
0211 xMat.Plant = MIMO_ML_CalcOmegaMat(x.Plant, nmax);
0212 
0213 
0214 %%%%%%%%%%%%%%%%%
0215 % WTLS estimate %
0216 %%%%%%%%%%%%%%%%%
0217 
0218 [Theta, smax, smin] = MIMO_LS_NewtonGaussStep(data, x, xMat, Sel, ModelVar);
0219 
0220 
0221 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0222 % denormalize the estimated parameters for s-, and sqrt(s)-domains %
0223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0224 
0225 Theta = MIMO_ML_DeNormalise(Theta, wscale, ModelVar);

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