Release Notes
54 | Summarizes new features, bug fixes, upgrade issues, etc.
55 |
56 |
57 |
58 |
59 |
60 | Originally developed by Ivo Houtzager
61 |
62 |
63 | Maintained by Pieter Gebraad
64 | Delft Center of Systems and Control
65 | Delft University of Technology
66 | p.m.o.gebraad@tudelft.nl
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/pbsidsetup.m:
--------------------------------------------------------------------------------
1 | % Add current directory to the current search path
2 | addpath(pwd);
3 | disp('PBSIDToolbox succesfully added to current search path.')
4 |
5 | % Add current directory to the startup path
6 | status = savepath;
7 | if status == 1
8 | warning('pbsidsetup:AddToPathdefFailed',['Could not add PBSIDToolbox to the MATLAB search path defaults. Try to add the toolbox path (',pwd,') manually to pathdef.m.'])
9 | else
10 | disp('PBSIDToolbox succesfully added to MATLAB search path defaults.')
11 | end
12 |
13 | compilation_ok = 1;
14 | % compile functions
15 | try
16 | disp('Compiling lpvitr...')
17 | mex('-O','@idafflpv/private/lpvitr.c');
18 | system('move lpvitr.* @idafflpv/private/');
19 | catch exception
20 | compilation_ok = 0;
21 | disp('Could not compile @idafflpv/private/lpvitr.c');
22 | disp('You can still use the slower ".m" version.');
23 | disp(['Compilation error: ',exception.message]);
24 | end
25 |
26 | try
27 | disp('Compiling sfun_rttime...')
28 | mex('-O','simulink/sfun_rttime.c');
29 | system('move sfun_rttime.* simulink/');
30 | catch exception
31 | compilation_ok = 0;
32 | disp('Could not compile simulink/sfun_rttime.c');
33 | disp(['Compilation error: ',exception.message]);
34 | end
35 |
36 | % compile functions SPGL1
37 | try
38 | disp('Compiling SPGL1 oneProjector to enable BPDN regularization...')
39 | mex private/spgl1oneProjector/oneProjectorMex.c private/spgl1oneProjector/oneProjectorCore.c private/spgl1oneProjector/heap.c -output private/oneProjectorMex -DNDEBUG
40 | catch exception
41 | compilation_ok = 0;
42 | disp('Could not compile oneProjector.');
43 | disp('You can still use the slower ".m" version.');
44 | disp(['Compilation error: ',exception.message]);
45 | end
46 | if compilation_ok
47 | disp('Compilation of mex files was succesful.')
48 | disp('PBSID setup completed');
49 | else
50 | disp('PBSID setup completed, but without compilation of MEX-files, resulting in slow algorithms.');
51 | disp('If the compiler was missing, please install one (e.g. the free Visual Studio C++ for Windows), and rerun the PBSID setup.');
52 | end
53 |
--------------------------------------------------------------------------------
/pec.m:
--------------------------------------------------------------------------------
1 | function v = pec(y,y_est)
2 | %PEC Prediction error cost
3 | % V = PEC(Y,Yest) computes the percentage of the model fit (FIT) between
4 | % the two signals Y and Yest. The FIT is calculated as:
5 | %
6 | % v = 1/sqrt(N) * ||y - y_est||_2
7 | %
8 | % The PEC of two signals that are the same is 0. If they differ, the
9 | % PEC will be higher. When Y and Yest have multiple columns, the PEC is
10 | % calculated for every column in Y and Yest. The PEC is often used to
11 | % verify the correctness of a model, by comparing the real output
12 | % with the estimated output of the model.
13 | %
14 | % See also VAF, FIT.
15 |
16 | % Ivo Houtzager
17 | % Delft Center of Systems and Control
18 | % Delft University of Technology
19 | % The Netherlands, 2010
20 |
21 | % check input arguments
22 | if nargin < 2
23 | error('PEC requires two input arguments!');
24 | end
25 |
26 | % check dimensions of inputs
27 | if size(y,2) > size(y,1)
28 | y = y';
29 | end
30 | if size(y_est,2) > size(y_est,1)
31 | y_est = y_est';
32 | end
33 | N = size(y,1);
34 | if size(y_est,1) ~= N
35 | error('Both signals should have an equal number of samples.');
36 | end
37 | if size(y,2) ~= size(y_est,2)
38 | error('Both signals should have an equal number of components.');
39 | end
40 |
41 | % compute prediction error cost
42 | v = zeros(size(y,2),1);
43 | for i = 1:size(y,2)
44 | v(i) = norm(y(:,i) - y_est(:,i))./sqrt(N);
45 | end
46 |
--------------------------------------------------------------------------------
/pmodx.m:
--------------------------------------------------------------------------------
1 | function [X,CC,vx,vy] = pmodx(X,TT,K,n,vx,vy)
2 | %PMODX Periodic LPV system identification using the PBSIDopt method.
3 | % [X,CC] = pmodx(X,UM,K,n) estimates the state sequence X of the
4 | % identifiable system with order n. The order n can be determined from the
5 | % correlation coefficients C given by dordopt. The matrices UM and K are
6 | % also calculated by pordvarx.
7 | %
8 | % [X,CC] = pmodx(X,UM,K,n,vx,vy) specifies the regularized parameters vx
9 | % and vy for the regularized canonical correlation analysis solver. For vx
10 | % > 0 and vy > 0, the solver can better deal with ill-conditioned
11 | % covariance matrices. To use the k-fold cross validation to calculate the
12 | % regularized parameter with best score, choose the vector vx as for
13 | % example vx = logspace(-8,-2). For vectors with lengths larger the two,
14 | % the code automatically uses cross validation. (default vx=0 and vy=0)
15 | %
16 | % [X,CC,vxm,vym] = pmodx(X,UM,K,n,vx,vy) also returns the best regularized
17 | % parameter found by the k-fold cross validation.
18 | %
19 | % References:
20 | % [1] van Wingerden, J.W., Houtzager, I., Verhaegen, M., Closed-loop
21 | % identification of the time-varying dynamics of variable-speed wind
22 | % turbines, Int. J. Robust Nonlinear Control 2008
23 | %
24 | % See also: pordxarx, px2abcdk, and px2abck.m.
25 |
26 | % Ivo Houtzager
27 | % Delft Center of Systems and Control
28 | % Delft University of Technology
29 | % The Netherlands, 2010
30 |
31 | % check number of arguments
32 | if nargin < 3
33 | error('PMODX requires at least three input arguments.');
34 | end
35 |
36 | % cheack the dimensions of the inputs
37 | if (n < 1) || isempty(n)
38 | error('System order of zero or lower does not make sense!')
39 | end
40 |
41 | % allocate matrices
42 | j = size(X,1);
43 | fl = size(TT{1},1);
44 | UM = zeros(j*fl,j*n);
45 | for q = 1:j
46 | UM((q-1)*fl+1:q*fl,(q-1)*n+1:q*n) = TT{q,1}(:,1:n);
47 | end
48 | clear TT;
49 |
50 | % solve intersection problem
51 | if (length(vx) > 1) || (length(vy) > 1)
52 | [vx,vy] = kfcv(UM,K,q,vx,vy);
53 | end
54 | [CC,TU] = rcca(UM,K,vx,vy);
55 |
56 | % obtain the state sequence using the transformation matrix
57 | TU = TU(1:j*n,1:n);
58 | for q = 1:j
59 | X{q,1} = TU((q-1)*n+1:n*q,:)\X{q,1}(1:n,:);
60 | end
61 |
62 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/private/NormGroupL2_dual.m:
--------------------------------------------------------------------------------
1 | function d = NormGroupL2_dual(groups,x,weights)
2 |
3 | if isreal(x)
4 | d = norm(sqrt(sum(groups * x.^2,2))./weights,inf);
5 | else
6 | d = norm(sqrt(sum(groups * abs(x).^2,2))./weights,inf);
7 | end
8 |
--------------------------------------------------------------------------------
/private/NormGroupL2_primal.m:
--------------------------------------------------------------------------------
1 | function p = NormGroupL2_primal(groups,x,weights)
2 |
3 | if isreal(x)
4 | p = sum(weights.*sqrt(sum(groups * x.^2,2)));
5 | else
6 | p = sum(weights.*sqrt(sum(groups * abs(x).^2,2)));
7 | end
8 |
--------------------------------------------------------------------------------
/private/NormGroupL2_project.m:
--------------------------------------------------------------------------------
1 | function x = NormGroupL2_project(groups,x,weights,tau)
2 | % Projection binary group matrix
3 |
4 | % Compute two-norms of rows
5 | if isreal(x)
6 | xa = sqrt(sum(groups * x.^2,2));
7 | else
8 | xa = sqrt(sum(groups * abs(x).^2,2));
9 | end
10 |
11 | % Project one one-norm ball
12 | idx = xa < eps;
13 | xc = oneProjector(xa,weights,tau);
14 |
15 | % Scale original
16 | xc = xc ./ xa; xc(idx) = 0;
17 | x = full(groups' * xc).*x;
18 |
--------------------------------------------------------------------------------
/private/NormL12_dual.m:
--------------------------------------------------------------------------------
1 | function d = NormL12_dual(g,x,weights)
2 |
3 | m = round(length(x) / g); n = g;
4 |
5 | if isreal(x)
6 | d = norm(sqrt(sum(reshape(x,m,n).^2,2))./weights,inf);
7 | else
8 | d = norm(sqrt(sum(abs(reshape(x,m,n)).^2,2))./weights,inf);
9 | end
10 |
11 |
12 |
--------------------------------------------------------------------------------
/private/NormL12_primal.m:
--------------------------------------------------------------------------------
1 | function p = NormL12_primal(g,x,weights)
2 |
3 | m = round(length(x) / g); n = g;
4 |
5 | if isreal(x)
6 | p = sum(weights.*sqrt(sum(reshape(x,m,n).^2,2)));
7 | else
8 | p = sum(weights.*sqrt(sum(abs(reshape(x,m,n)).^2,2)));
9 | end
10 |
--------------------------------------------------------------------------------
/private/NormL12_project.m:
--------------------------------------------------------------------------------
1 | function x = NormL12_project(g,x,weights,tau)
2 | % Projection with number of groups equal to g
3 |
4 | % Convert to matrix
5 | m = round(length(x) / g); n = g;
6 | x = reshape(x,m,n);
7 |
8 | % Compute two-norms of rows
9 | if isreal(x)
10 | xa = sqrt(sum(x.^2,2));
11 | else
12 | xa = sqrt(sum(abs(x).^2,2));
13 | end
14 |
15 | % Project one one-norm ball
16 | idx = xa < eps;
17 | xc = oneProjector(xa,weights,tau);
18 |
19 | % Scale original
20 | xc = xc ./ xa; xc(idx) = 0;
21 | x = spdiags(xc,0,m,m)*x;
22 |
23 | % Vectorize result
24 | x = x(:);
25 |
--------------------------------------------------------------------------------
/private/NormL1_dual.m:
--------------------------------------------------------------------------------
1 | function d = NormL1_dual(x,weights)
2 |
3 | d = norm(x./weights,inf);
4 |
--------------------------------------------------------------------------------
/private/NormL1_primal.m:
--------------------------------------------------------------------------------
1 | function p = NormL1_primal(x,weights)
2 |
3 | p = norm(x.*weights,1);
4 |
--------------------------------------------------------------------------------
/private/NormL1_project.m:
--------------------------------------------------------------------------------
1 | function x = NormL1_project(x,weights,tau)
2 |
3 | if isreal(x)
4 | x = oneProjector(x,weights,tau);
5 | else
6 | xa = abs(x);
7 | idx = xa < eps;
8 | xc = oneProjector(xa,weights,tau);
9 | xc = xc ./ xa; xc(idx) = 0;
10 | x = x .* xc;
11 | end
12 |
--------------------------------------------------------------------------------
/private/allcomb.m:
--------------------------------------------------------------------------------
1 | function B = allcomb(A)
2 | %% all combinations of columns in A
3 |
4 | [ni,nm] = size(A);
5 | ii = ni:-1:1;
6 | A = mat2cell(A, ones(1,ni), nm);
7 | % flip using ii if last column is changing fastest
8 | [B{ii}] = ndgrid(A{ii}) ;
9 | % concatenate
10 | B = reshape(cat(ni+1,B{:}),[],ni)';
11 | end
--------------------------------------------------------------------------------
/private/dpkalm.m:
--------------------------------------------------------------------------------
1 | function [K,S,E] = dpkalm(A,C,Q,R,S,F,N)
2 | %DPKALM Dynamic programming of Kalman design for a discrete state-space system.
3 | % [K,P,E] = DPKALM(A,C,Q,R,S,F,N) calculates the optimal gain matrices
4 | % K[n] such that:
5 | %
6 | % For a discrete-time state-space model SYS, u[n] = -K[n]x[n] minimizes
7 | %
8 | % J = 0.5*Sum {x[n]'Qx[n] + u[n]'Ru[n] + x[n]'Su[n]} + 0.5*x[-1]'Fx[-1]
9 | %
10 | % subject to x[n+1] = Ax[n] + Bu[n] with n = 0...N-1.
11 | %
12 | % Also returned are the the solution S of the associated algebraic
13 | % Riccati equation and the closed-loop eigenvalues E = EIG(A-K*C).
14 |
15 | % Ivo Houtzager
16 | % Delft Center of Systems and Control
17 | % Delft University of Technology
18 | % The Netherlands, 2010
19 |
20 | % check number of input arguments
21 | if nargin ~=7
22 | error('DPKALM requires at least five or six input arguments')
23 | end
24 | if ndims(A) > 2;
25 | array = 2;
26 | else
27 | array = 1;
28 | end
29 |
30 | % check dimensions and symmetry
31 | [nax ns nna] = size(A);
32 | [ncx nc nnc] = size(C);
33 | [nqx nq nnq] = size(Q);
34 | [nfx nf nnf] = size(F);
35 | [nrx nr nnr] = size(R);
36 | if ~isequal(nna,nnc,nnq,nnr,N);
37 | if array == 2
38 | error('The number of arrays have to be equal to N.');
39 | end
40 | end
41 | if ~isequal(nc,ns);
42 | error('The A and C matrices must have the same number of columns.')
43 | end
44 | if ~isequal(nqx,nax,nfx,ns,nq,nf);
45 | error('The A, Q and F matrices must be the same size.')
46 | end
47 | if ~isequal(nrx,nr,ncx);
48 | error('The R matrix must be square with as many rows as C.')
49 | end
50 | if ~isreal(Q) || ~isreal(R)
51 | error('The weight matrices Q, R must be real valued.')
52 | end
53 |
54 | % backwards iteration
55 | K = zeros(nb,ns,N);
56 | E = zeros(ns,N);
57 | X = zeros(ns,ns,N+1);
58 | X(:,:,1) = F;
59 | switch array
60 | case 1
61 | for t = 1:N
62 | K(:,:,t) = (R + C*X(:,:,t)*C')\(C*X(:,:,t)*A' + S');
63 | X(:,:,t+1) = (A - K(:,:,t)*C(:,:,t))*X(:,:,t)*(A - K(:,:,t)*C(:,:,t))' + K(:,:,t)'*R*K(:,:,t) + Q;
64 | if nargout >= 2
65 | E(:,t) = eig(A - K(:,:,t)*C);
66 | end
67 | end
68 | case 2
69 | for t = 1:N
70 | K(:,:,t) = (R(:,:,t) + C(:,:,t)*X(:,:,t)*C(:,:,t)')\(C(:,:,t)*X(:,:,t+1)*A(:,:,t)' + S(:,:,t)');
71 | X(:,:,t+1) = (A(:,:,t) - K(:,:,t)*C(:,:,t))*X(:,:,t)*(A(:,:,t) - K(:,:,t)*C(:,:,t))' + K(:,:,t)'*R(:,:,t)*K(:,:,t) + Q(:,:,t);
72 | if nargout >= 2
73 | E(:,t) = eig(A(:,:,t) - K(:,:,t)*C(:,:,t));
74 | end
75 | end
76 | end
77 |
78 |
--------------------------------------------------------------------------------
/private/dplqr.m:
--------------------------------------------------------------------------------
1 | function [K,S,E] = dplqr(A,B,Q,R,F,N)
2 | %DPLQR Dynamic programming of LQR design for a discrete state-space system.
3 | % [K,S,E] = DPLQR(A,B,Q,R,F,N) calculates the optimal gain matrices K[n]
4 | % such that:
5 | %
6 | % For a discrete-time state-space model SYS, u[n] = -K[n]x[n] minimizes
7 | %
8 | % J = 0.5*Sum {x[n]'Qx[n] + u[n]'Ru[n]} + 0.5*x[N]'Fx[N]
9 | %
10 | % subject to x[n+1] = Ax[n] + Bu[n] with n = 0...N-1.
11 | %
12 | % Also returned are the the solution S of the associated algebraic
13 | % Riccati equation and the closed-loop eigenvalues E = EIG(A-B*K).
14 |
15 | % Ivo Houtzager
16 | % Delft Center of Systems and Control
17 | % Delft University of Technology
18 | % The Netherlands, 2010
19 |
20 | % check number of input arguments
21 | if nargin < 5
22 | error('DPLQR requires at least five or six input arguments')
23 | end
24 | if ndims(A) > 2;
25 | array = 2;
26 | else
27 | array = 1;
28 | end
29 |
30 | % check dimensions and symmetry
31 | [nax ns nna] = size(A);
32 | [nbx nb nnb] = size(B);
33 | [nqx nq nnq] = size(Q);
34 | [nfx nf nnf] = size(F);
35 | [nrx nr nnr] = size(R);
36 | if ~isequal(nna,nnb,nnq,nnr,N);
37 | if array == 2
38 | error('The number of arrays have to be equal to N.');
39 | end
40 | end
41 | if ~isequal(nbx,nax);
42 | error('The A and B matrices must have the same number of rows.')
43 | end
44 | if ~isequal(nqx,nax,nfx,ns,nq,nf);
45 | error('The A, Q and F matrices must be the same size.')
46 | end
47 | if ~isequal(nrx,nr,nb);
48 | error('The R matrix must be square with as many columns as B.')
49 | end
50 | if ~isreal(Q) || ~isreal(R)
51 | error('The weight matrices Q, R must be real valued.')
52 | end
53 |
54 | % backwards iteration
55 | K = zeros(nb,ns,N);
56 | E = zeros(ns,N);
57 | S = zeros(ns,ns,N);
58 | S(:,:,N+1) = F;
59 | switch array
60 | case 1
61 | for t = N:-1:1
62 | K(:,:,t) = (R + B'*S(:,:,t+1)*B)\B'*S(:,:,t+1)*A;
63 | S(:,:,t) = (A - B*K(:,:,t))'*S(:,:,t+1)*(A - B*K(:,:,t)) + K(:,:,t)'*R*K(:,:,t) + Q;
64 | if nargout >= 2
65 | E(:,t) = eig(A - B*K(:,:,t));
66 | end
67 | end
68 | case 2
69 | for t = N:-1:1
70 | K(:,:,t) = (R(:,:,t) + B(:,:,t)'*S(:,:,t+1)*B(:,:,t))\B(:,:,t)'*S(:,:,t+1)*A(:,:,t);
71 | S(:,:,t) = (A(:,:,t) - B(:,:,t)*K(:,:,t))'*S(:,:,t+1)*(A(:,:,t) - B(:,:,t)*K(:,:,t)) + K(:,:,t)'*R(:,:,t)*K(:,:,t) + Q(:,:,t);
72 | if nargout >= 2
73 | E(:,t) = eig(A(:,:,t) - B(:,:,t)*K(:,:,t));
74 | end
75 | end
76 | end
77 |
78 |
--------------------------------------------------------------------------------
/private/ensure.m:
--------------------------------------------------------------------------------
1 | function ensure(condition)
2 |
3 | % ensure.m
4 | % $Id: ensure.m 800 2008-02-26 22:32:04Z mpf $
5 | %
6 | % ----------------------------------------------------------------------
7 | % This file is part of SPGL1 (Spectral Projected Gradient for L1).
8 | %
9 | % Copyright (C) 2007 Ewout van den Berg and Michael P. Friedlander,
10 | % Department of Computer Science, University of British Columbia, Canada.
11 | % All rights reserved. E-mail: <{ewout78,mpf}@cs.ubc.ca>.
12 | %
13 | % SPGL1 is free software; you can redistribute it and/or modify it
14 | % under the terms of the GNU Lesser General Public License as
15 | % published by the Free Software Foundation; either version 2.1 of the
16 | % License, or (at your option) any later version.
17 | %
18 | % SPGL1 is distributed in the hope that it will be useful, but WITHOUT
19 | % ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 | % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
21 | % Public License for more details.
22 | %
23 | % You should have received a copy of the GNU Lesser General Public
24 | % License along with SPGL1; if not, write to the Free Software
25 | % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
26 | % USA
27 | % ----------------------------------------------------------------------
28 |
29 | if ~condition
30 | [ST,I] = dbstack;
31 | msg = 'Assertion failed';
32 | if length(ST) > 1
33 | msg = sprintf('%s in %s; function %s line %d', ...
34 | msg, ST(2).file, ST(2).name, ST(2).line);
35 | end
36 |
37 | errstr.message = msg;
38 | error(errstr);
39 | end
40 |
41 | end % function ensure
42 |
--------------------------------------------------------------------------------
/private/khatrirao.m:
--------------------------------------------------------------------------------
1 | function P = khatrirao(varargin)
2 | %KHATRIRAO Khatri-Rao product of matrices.
3 | % KHATRIRAO(A,B) computes the Khatri-Rao product of matrices A and
4 | % B that have the same number of columns. The result is the
5 | % column-wise Kronecker product
6 | % [KRON(A(:,1),B(:,1)) ... KRON(A(:,n),B(:,n))]
7 | %
8 | % KHATRIRAO(A1,A2,...) computes the Khatri-Rao product of
9 | % multiple matrices that have the same number of columns.
10 | %
11 | % KHATRIRAO(C) computes the Khatri-Rao product of
12 | % the matrices in cell array C.
13 | %
14 | % KHATRIRAO(...,'r') computes the Khatri-Rao product in reverse
15 | % order.
16 | %
17 | % Examples
18 | % A = rand(5,2); B = rand(3,2); C = rand(2,2);
19 | % khatrirao(A,B) %<-- Khatri-Rao of A and B
20 | % khatrirao(B,A,'r') %<-- same thing as above
21 | % khatrirao({C,B,A}) %<-- passing a cell array
22 | % khatrirao({A,B,C},'r') %<-- same as above
23 | %
24 | % See also TENSOR, KTENSOR.
25 |
26 | % MATLAB Tensor Toolbox.
27 | % Copyright 2009, Sandia Corporation.
28 |
29 | %% Error checking on input and set matrix order
30 | % Note that this next if/else check forces A to be a cell array.
31 | if ischar(varargin{end}) && varargin{end} == 'r'
32 | if nargin == 2 && iscell(varargin{1})
33 | % Input is a single cell array
34 | A = varargin{1};
35 | else
36 | % Input is a sequence of matrices
37 | A = {varargin{1:end-1}};
38 | end
39 | matorder = length(A):-1:1;
40 | else
41 | if nargin == 1 && iscell(varargin{1})
42 | % Input is a single cell array
43 | A = varargin{1};
44 | else
45 | % Input is a sequence of matrices
46 | A = varargin;
47 | end
48 | matorder = 1:length(A);
49 | end
50 |
51 | %% Error check on matrices and compute number of rows in result
52 |
53 | % N = number of columns (must be the same for every input)
54 | N = size(A{1},2);
55 |
56 | % After loop, M = number of rows in the result
57 | M = 1;
58 |
59 | for i = matorder
60 | if ndims(A) ~= 2
61 | error('Each argument must be a matrix');
62 | end
63 | if (N ~= size(A{i},2))
64 | error('All matrices must have the same number of columns.')
65 | end
66 | M = M * size(A{i},1);
67 | end
68 |
69 | %% Computation
70 |
71 | % Preallocate
72 | P = zeros(M,N);
73 |
74 | % Loop through all the columns
75 | for n = 1:N
76 | % Loop through all the matrices
77 | ab = A{matorder(1)}(:,n);
78 | for i = matorder(2:end)
79 | % Compute outer product of nth columns
80 | ab = A{i}(:,n) * ab(:).';
81 | end
82 | % Fill nth column of P with reshaped result
83 | P(:,n) = ab(:);
84 | end
85 |
86 |
--------------------------------------------------------------------------------
/private/kpinv.m:
--------------------------------------------------------------------------------
1 | function X = kpinv(A,B,varargin)
2 | %KPINV Pseudoinverse of Kronecker product.
3 | % X=KPINV(A,B) produces a matrix X of the same dimensions as KRON(A',B')
4 | % so that KRON(A,B)*X*KRON(A,B)=KRON(A,B), X*KRON(A,B)*X=X and KRON(A,B)*X
5 | % and X*KRON(A,B) are Hermitian. The computation is based on A=U1*S1*V1'
6 | % and B=U2*S2*V2', because KRON(A,B)=KRON(U2,U2)*KRON(S1,S2)*KRON(V1,V2)'.
7 | % Any singular values less than a tolerance are treated as zero. The
8 | % default tolerances are MAX(SIZE(KRON(A,B)))*EPS(class(A)).
9 | %
10 | % KPINV(A,B,TOL) uses the tolerance TOL instead of the default.
11 | %
12 | % See also PINV.
13 |
14 | % Revised version of PINV for kronecker products, is faster and needs less
15 | % memory especially when large matrices are being used.
16 |
17 | % Ivo Houtzager
18 | % Delft Center of Systems and Control
19 | % Delft University of Technology
20 | % The Netherlands, 2010
21 |
22 | % sizes
23 | [m1,n1] = size(A);
24 | [m2,n2] = size(B);
25 | m = m1*m2;
26 | n = n1*n2;
27 |
28 | % quick return if matrices are empty
29 | if isempty(A)
30 | X = zeros(n,m,class(A));
31 | return
32 | end
33 |
34 | if n > m
35 | X = kpinv(A',B',varargin{:})';
36 | else
37 | [U1,S1,V1] = svd(A,0);
38 | [U2,S2,V2] = svd(B,0);
39 |
40 | if m > 1,
41 | s1 = diag(S1);
42 | s2 = diag(S2);
43 | s = kron(s1,s2);
44 | elseif m == 1,
45 | s1 = S1(1);
46 | s2 = S2(1);
47 | s = s1*s2;
48 | else
49 | s1 = 0;
50 | s2 = 0;
51 | s = 0;
52 | end
53 |
54 | if nargin == 3
55 | tol1 = varargin{1};
56 | tol2 = tol1;
57 | else
58 | tol1 = max(m1,n1)*eps(max(s1));
59 | tol2 = max(m2,n2)*eps(max(s2));
60 | end
61 |
62 | r1 = sum(s1 > tol1);
63 | r2 = sum(s2 > tol2);
64 | r = r1*r2;
65 | if (r == 0)
66 | X = zeros(n,m,class(A));
67 | else
68 | s = diag(ones(r,1)./s(1:r));
69 | X = kron(V1(:,1:r1),V2(:,1:r2))*s*kron(U1(:,1:r1)',U2(:,1:r2)');
70 | end
71 | end
72 |
--------------------------------------------------------------------------------
/private/logx.m:
--------------------------------------------------------------------------------
1 | function logx
2 | %LOGX Turn the X axis to LOG
3 | % LOGX turns the X axis of the current plot to log coordinates.
4 | %
5 | % See also LINX, LINY, LOGY.
6 |
7 | set(gca,'XScale','log');
8 | end
--------------------------------------------------------------------------------
/private/nuclear.m:
--------------------------------------------------------------------------------
1 | function X = nuclear(Y,Z,reg_min,tol,maxit,X0)
2 | %NUCLEAR Matrix regression with nuclear norm optimisation
3 | % X=NUCLEAR(Y,Z,reg_min) solves the least squares regression problem with
4 | % nuclear norm regularisation. The inputs are the matrices Y and Z, which
5 | % have the same number of columns. Output is the least squares estimate X.
6 | %
7 | % X=NUCLEAR(Y,Z,reg_min,tol) specifies the tolerance of the nonsmooth
8 | % gradient method. If tol is [] then NUCLEAR uses the default, 1e-4.
9 | %
10 | % X=NUCLEAR(Y,Z,reg_min,tol,maxit) specifies the maximum number of
11 | % iterations. If MAXIT is [] then NUCLEAR uses the default, 200. Warning
12 | % is given when the maximum iterations is reached.
13 | %
14 | % X=NUCLEAR(Y,Z,reg_min,tol,maxit,X0) specifies the initial least squares
15 | % estimate X.
16 |
17 | % Ivo Houtzager
18 | % Delft Center of Systems and Control
19 | % Delft University of Technology
20 | % The Netherlands, 2010
21 |
22 | % assign default values to unspecified parameters
23 | if (nargin < 6) || isempty(X0)
24 | X0 = Y*pinv(Z);
25 | end
26 | if (nargin < 5) || isempty(maxit)
27 | maxit = 200;
28 | end
29 | if (nargin < 4) || isempty(tol)
30 | tol = 1e-4;
31 | end
32 |
33 | % do the nonsmooth gradient iterations
34 | lambda = 1;
35 | N = length(Y);
36 | X = X0;
37 | ok = true;
38 | k = 1;
39 | cost1 = 1e10;
40 | while ok == true && k <= maxit
41 | % evaluate function
42 | E = Y - X*Z;
43 | cost = norm(E','fro')^2 + reg_min^2*sum(svd(X));
44 |
45 | % check residue
46 | if abs(cost1 - cost) <= tol^2*N
47 | ok = false;
48 | end
49 |
50 | % recalculate gradient step
51 | k = k + 1;
52 | lambda = fminbnd(@(x) (norm((Y-(X + x.*(E*Z'))*Z)','fro')^2 + reg_min^2*sum(svd(X + x.*(E*Z'))))/N,0,lambda);
53 |
54 | % step update with tresholding
55 | X = X + lambda.*(E*Z');
56 | [U,S,V] = svd(X);
57 | if size(Y,1) == 1
58 | X = U*diag(max(S(1,1)-reg_min^2*lambda,0))*V(:,1)';
59 | else
60 | X = U*diag(max(diag(S)-reg_min^2*lambda,0))*V(:,1:length(diag(S)))';
61 | end
62 |
63 | % swap
64 | cost1 = cost;
65 | end
--------------------------------------------------------------------------------
/private/oneProjectorMex.mexw64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/private/oneProjectorMex.mexw64
--------------------------------------------------------------------------------
/private/spg_bp.m:
--------------------------------------------------------------------------------
1 | function [x,r,g,info] = spg_bp(A,b,options )
2 | %SPG_BP Solve the basis pursuit (BP) problem
3 | %
4 | % SPG_BP is designed to solve the basis pursuit problem
5 | %
6 | % (BP) minimize ||X||_1 subject to AX = B,
7 | %
8 | % where A is an M-by-N matrix, B is an M-vector, and SIGMA is a
9 | % nonnegative scalar. In all cases below, A can be an explicit M-by-N
10 | % matrix or matrix-like object for which the operations A*x and A'*y
11 | % are defined (i.e., matrix-vector multiplication with A and its
12 | % adjoint.)
13 | %
14 | % Also, A can be a function handle that points to a function with the
15 | % signature
16 | %
17 | % v = A(w,mode) which returns v = A *w if mode == 1;
18 | % v = A'*w if mode == 2.
19 | %
20 | % X = SPG_BP(A,B) solves the BP problem.
21 | %
22 | % X = SPG_BP(A,B,OPTIONS) specifies options that are set using
23 | % SPGSETPARMS.
24 | %
25 | % [X,R,G,INFO] = SPG_BP(A,B,OPTIONS) additionally returns the
26 | % residual R = B - A*X (which should be small), the objective gradient G
27 | % = A'*R, and an INFO structure. (See SPGL1 for a description of this
28 | % last output argument.)
29 | %
30 | % See also spgl1, spgSetParms, spg_bpdn, spg_lasso.
31 |
32 | % Copyright 2008, Ewout van den Berg and Michael P. Friedlander
33 | % http://www.cs.ubc.ca/labs/scl/spgl1
34 | % $Id: spg_bp.m 1074 2008-08-19 05:24:28Z ewout78 $
35 |
36 | if ~exist('options','var'), options = []; end
37 | if ~exist('b','var') || isempty(b)
38 | error('Second argument cannot be empty.');
39 | end
40 | if ~exist('A','var') || isempty(A)
41 | error('First argument cannot be empty.');
42 | end
43 |
44 | sigma = 0;
45 | tau = 0;
46 | x0 = [];
47 | [x,r,g,info] = spgl1(A,b,tau,sigma,x0,options);
48 |
--------------------------------------------------------------------------------
/private/spg_bpdn.m:
--------------------------------------------------------------------------------
1 | function [x,r,g,info] = spg_bpdn( A, b, sigma, options )
2 | %SPG_BPDN Solve the basis pursuit denoise (BPDN) problem
3 | %
4 | % SPG_BPDN is designed to solve the basis pursuit denoise problem
5 | %
6 | % (BPDN) minimize ||X||_1 subject to ||A X - B|| <= SIGMA,
7 | %
8 | % where A is an M-by-N matrix, B is an M-vector, and SIGMA is a
9 | % nonnegative scalar. In all cases below, A can be an explicit M-by-N
10 | % matrix or matrix-like object for which the operations A*x and A'*y
11 | % are defined (i.e., matrix-vector multiplication with A and its
12 | % adjoint.)
13 | %
14 | % Also, A can be a function handle that points to a function with the
15 | % signature
16 | %
17 | % v = A(w,mode) which returns v = A *w if mode == 1;
18 | % v = A'*w if mode == 2.
19 | %
20 | % X = SPG_BPDN(A,B,SIGMA) solves the BPDN problem. If SIGMA=0 or
21 | % SIGMA=[], then the basis pursuit (BP) problem is solved; i.e., the
22 | % constraints in the BPDN problem are taken as AX=B.
23 | %
24 | % X = SPG_BPDN(A,B,SIGMA,OPTIONS) specifies options that are set using
25 | % SPGSETPARMS.
26 | %
27 | % [X,R,G,INFO] = SPG_BPDN(A,B,SIGMA,OPTIONS) additionally returns the
28 | % residual R = B - A*X, the objective gradient G = A'*R, and an INFO
29 | % structure. (See SPGL1 for a description of this last output argument.)
30 | %
31 | % See also spgl1, spgSetParms, spg_bp, spg_lasso.
32 |
33 | % Copyright 2008, Ewout van den Berg and Michael P. Friedlander
34 | % http://www.cs.ubc.ca/labs/scl/spgl1
35 | % $Id: spg_bpdn.m 1074 2008-08-19 05:24:28Z ewout78 $
36 |
37 | if ~exist('options','var'), options = []; end
38 | if ~exist('sigma','var'), sigma = []; end
39 | if ~exist('b','var') || isempty(b)
40 | error('Second argument cannot be empty.');
41 | end
42 | if ~exist('A','var') || isempty(A)
43 | error('First argument cannot be empty.');
44 | end
45 |
46 | tau = 0;
47 | x0 = [];
48 | [x,r,g,info] = spgl1(A,b,tau,sigma,x0,options);
49 |
--------------------------------------------------------------------------------
/private/spg_lasso.m:
--------------------------------------------------------------------------------
1 | function [x,r,g,info] = spg_lasso(A,b,tau,options )
2 | %SPG_LASSO Solve the LASSO problem
3 | %
4 | % SPG_LASSO is designed to solve the LASSO problem
5 | %
6 | % (LASSO) minimize ||AX - B||_2 subject to ||X||_1 <= tau,
7 | %
8 | % where A is an M-by-N matrix, B is an M-vector, and TAU is a
9 | % nonnegative scalar. In all cases below, A can be an explicit M-by-N
10 | % matrix or matrix-like object for which the operations A*x and A'*y
11 | % are defined (i.e., matrix-vector multiplication with A and its
12 | % adjoint.)
13 | %
14 | % Also, A can be a function handle that points to a function with the
15 | % signature
16 | %
17 | % v = A(w,mode) which returns v = A *w if mode == 1;
18 | % v = A'*w if mode == 2.
19 | %
20 | % X = SPG_LASSO(A,B,TAU) solves the LASSO problem.
21 | %
22 | % X = SPG_LASSO(A,B,TAU,OPTIONS) specifies options that are set using
23 | % SPGSETPARMS.
24 | %
25 | % [X,R,G,INFO] = SPG_LASSO(A,B,TAU,OPTIONS) additionally returns the
26 | % residual R = B - A*X, the objective gradient G = A'*R, and an INFO
27 | % structure. (See SPGL1 for a description of this last output argument.)
28 | %
29 | % See also spgl1, spgSetParms, spg_bp, spg_bpdn.
30 |
31 | % Copyright 2008, Ewout van den Berg and Michael P. Friedlander
32 | % http://www.cs.ubc.ca/labs/scl/spgl1
33 | % $Id: spg_lasso.m 1074 2008-08-19 05:24:28Z ewout78 $
34 |
35 | if ~exist('options','var'), options = []; end
36 | if ~exist('tau','var'), tau = []; end
37 | if ~exist('b','var') || isempty(b)
38 | error('Second argument cannot be empty.');
39 | end
40 | if ~exist('A','var') || isempty(A)
41 | error('First argument cannot be empty.');
42 | end
43 |
44 | sigma = [];
45 | x0 = [];
46 | [x,r,g,info] = spgl1(A,b,tau,sigma,x0,options);
47 |
--------------------------------------------------------------------------------
/private/spgl1oneProjector/oneProjectorCore.h:
--------------------------------------------------------------------------------
1 | /* oneProjectorCore.h
2 | $Id $
3 |
4 | ----------------------------------------------------------------------
5 | This file is part of SPGL1 (Spectral Projected Gradient for L1).
6 |
7 | Copyright (C) 2007 Ewout van den Berg and Michael P. Friedlander,
8 | Department of Computer Science, University of British Columbia, Canada.
9 | All rights reserved. E-mail: <{ewout78,mpf}@cs.ubc.ca>.
10 |
11 | SPGL1 is free software; you can redistribute it and/or modify it
12 | under the terms of the GNU Lesser General Public License as
13 | published by the Free Software Foundation; either version 2.1 of the
14 | License, or (at your option) any later version.
15 |
16 | SPGL1 is distributed in the hope that it will be useful, but WITHOUT
17 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
19 | Public License for more details.
20 |
21 | You should have received a copy of the GNU Lesser General Public
22 | License along with SPGL1; if not, write to the Free Software
23 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
24 | USA
25 | ----------------------------------------------------------------------
26 | */
27 | #ifndef __ONEPROJECTORCORE_H__
28 | #define __ONEPROJECTORCORE_H__
29 |
30 | /* The entries in b are non-negative, those in d strictly positive */
31 | int projectI( double xPtr[], double bPtr[], double tau, int n );
32 | int projectD( double xPtr[], double bPtr[], double dPtr[], double dOrg[], double tau, int n );
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/pschedclust.m:
--------------------------------------------------------------------------------
1 | function pind = pschedclust(mu,f,p,tol1,tol2)
2 | %PSCHEDCLUST Periodic clustering of scheduling sequence
3 | % pind=pschedclust(mu,f,p,tol1,tol2) clusters the (quasi) scheduling sequence
4 | % mu for periodic repetitions of p sized windows. It is intended as a
5 | % preprocessor for pordvarx. The algortihm uses a divide and conqeur
6 | % approach for sorting the p windowed vectors. After sorting the vectors
7 | % are bined in group up to a tolerance tol.
8 | %
9 | % See also: pordvarx, pmodx, px2abck, px2abcdk.
10 |
11 | % Ivo Houtzager
12 | % Delft Center of Systems and Control
13 | % Delft University of Technology
14 | % The Netherlands, 2010
15 |
16 | % assign default values to unspecified parameters
17 | if (nargin < 5) || isempty(tol2)
18 | tol1 = 1e-3;
19 | end
20 | if (nargin < 5) || isempty(tol1)
21 | tol2 = 1e-3;
22 | end
23 |
24 | % check dimensions of inputs
25 | if size(mu,2) < size(mu,1)
26 | mu = mu';
27 | end
28 | N = size(mu,2);
29 | s = size(mu,1);
30 |
31 | % check the size of the windows
32 | if f > p
33 | error('Future window size f must equal or smaller then past window p. (f <= p)')
34 | end
35 |
36 | % clustering of scheduling periods
37 | k = 0;
38 | pvec = [];
39 | MU = zeros((p+f)*s,N-p-f+1);
40 | for i = 1:N-p-f+1
41 | d = mu(:,i:i+p+f-1);
42 | MU(:,i) = d(:);
43 | end
44 |
45 | % cluster by divide and conquer
46 | msum = sum(MU,1)./(p+f);
47 | for i = 1:N-p-f+1
48 | if isempty(pvec) || ~any(pvec == i)
49 | k = k + 1;
50 | pvec = [pvec i];
51 | pind{k,1} = i;
52 | mind = find((msum >= (msum(i) - tol1)) & (msum <= (msum(i) + tol1)));
53 | for j = 1:length(mind)
54 | if i ~= mind(j) && ~any(pvec == mind(j))
55 | if norm(MU(:,i) - MU(:,mind(j)))/sqrt(p+f) <= tol2
56 | pvec = [pvec mind(j)];
57 | pind{k,1} = [pind{k,1} mind(j)];
58 | end
59 | end
60 | end
61 | end
62 | end
63 | MU = [];
64 | end
65 |
66 |
--------------------------------------------------------------------------------
/sigscale.m:
--------------------------------------------------------------------------------
1 | function [us,Du,ys,Dy,zs,Dz] = sigscale(u,y,z)
2 | %SIGSCALE Scaling of Identifications Signals
3 | % [US,DU,YS,DY]=SIGSCALE(U,Y) scales the input and output signals U and
4 | % Y, such that the returned signal have the variance VAR(US)=1 and
5 | % VAR(YS)=1. The scaling matrices DU and DY can be used to convert the
6 | % amplitudes back to original size Y=DY*YS and U=DU*US. The original
7 | % state-space system is obtained from the identified system as follows:
8 | %
9 | % x(k+1) = A x(k) + B/Du u(k)
10 | % y(k) = Dy*C x(k) + Dy*D/Du u(k)
11 |
12 | % Ivo Houtzager
13 | % Delft Center of Systems and Control
14 | % Delft University of Technology
15 | % The Netherlands, 2010
16 |
17 | % check number if input arguments
18 | if nargin < 2
19 | error('SIGSCALE requires two input arguments.')
20 | end
21 |
22 | % check dimensions of inputs
23 | if size(y,2) < size(y,1)
24 | y = y';
25 | end
26 | if size(u,2) < size(u,1)
27 | u = u';
28 | end
29 | % N = size(y,2);
30 | % if ~isequal(N,length(u))
31 | % error('The number of rows of vectors/matrices u and y must be the same.')
32 | % end
33 |
34 | Dy = diag(sqrt(var(y,0,2))); % output scaling matrix
35 | ys = diag(1./diag(Dy))*y; % scaling
36 |
37 | Du = diag(sqrt(var(u,0,2))); % input scaling matrix
38 | us = diag(1./diag(Du))*u; % scaling
39 |
40 | if nargin > 2
41 | if size(z,2) < size(z,1)
42 | z = z';
43 | end
44 | Dz = diag(sqrt(var(z,0,2))); % output scaling matrix
45 | zs = diag(1./diag(Dz))*z; % scaling
46 | end
47 |
--------------------------------------------------------------------------------
/simulink/GUST2data.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/GUST2data.mat
--------------------------------------------------------------------------------
/simulink/GUST2weight_f10.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/GUST2weight_f10.mat
--------------------------------------------------------------------------------
/simulink/GUST2weight_f5.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/GUST2weight_f5.mat
--------------------------------------------------------------------------------
/simulink/GUST2weight_f50.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/GUST2weight_f50.mat
--------------------------------------------------------------------------------
/simulink/sfun_rttime.mexw64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/sfun_rttime.mexw64
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/info/binfo.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/info/binfo.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/info/chart5_YAcMENJsgW1dTHFHNLCtkC.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/info/chart5_YAcMENJsgW1dTHFHNLCtkC.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/c5_sim1_rlti_varmax_gust2.h:
--------------------------------------------------------------------------------
1 | #ifndef __c5_sim1_rlti_varmax_gust2_h__
2 | #define __c5_sim1_rlti_varmax_gust2_h__
3 |
4 | /* Include files */
5 | #include "sfc_sf.h"
6 | #include "sfc_mex.h"
7 | #include "rtwtypes.h"
8 |
9 | /* Type Definitions */
10 | typedef struct {
11 | const char * context;
12 | const char * name;
13 | const char * dominantType;
14 | const char * resolved;
15 | uint32_T fileTimeLo;
16 | uint32_T fileTimeHi;
17 | uint32_T mFileTimeLo;
18 | uint32_T mFileTimeHi;
19 | } c5_ResolvedFunctionInfo;
20 |
21 | typedef struct {
22 | SimStruct *S;
23 | real_T c5_ABK[70];
24 | real_T c5_CD[16];
25 | real_T c5_Du;
26 | real_T c5_Dy[4];
27 | real_T c5_E1[2];
28 | real_T c5_LK[25000];
29 | real_T c5_Pabk[100];
30 | real_T c5_Pcd[64];
31 | real_T c5_Plk[63504];
32 | real_T c5_U1;
33 | real_T c5_VARX[504];
34 | real_T c5_W[700];
35 | real_T c5_X[7];
36 | real_T c5_X1[7];
37 | real_T c5_Y1[2];
38 | real_T c5_Zp[250];
39 | real_T c5_k;
40 | real_T c5_saw;
41 | real_T c5_start;
42 | real_T c5_w[300];
43 | boolean_T c5_ABK_not_empty;
44 | boolean_T c5_CD_not_empty;
45 | boolean_T c5_E1_not_empty;
46 | boolean_T c5_LK_not_empty;
47 | boolean_T c5_Pabk_not_empty;
48 | boolean_T c5_Pcd_not_empty;
49 | boolean_T c5_Plk_not_empty;
50 | boolean_T c5_U1_not_empty;
51 | boolean_T c5_VARX_not_empty;
52 | boolean_T c5_X1_not_empty;
53 | boolean_T c5_X_not_empty;
54 | boolean_T c5_Y1_not_empty;
55 | boolean_T c5_Zp_not_empty;
56 | boolean_T c5_k_not_empty;
57 | boolean_T c5_saw_not_empty;
58 | boolean_T c5_start_not_empty;
59 | boolean_T c5_w_not_empty;
60 | uint8_T c5_is_active_c5_sim1_rlti_varmax_gust2;
61 | ChartInfoStruct chartInfo;
62 | } SFc5_sim1_rlti_varmax_gust2InstanceStruct;
63 |
64 | /* Named Constants */
65 |
66 | /* Variable Declarations */
67 |
68 | /* Variable Definitions */
69 |
70 | /* Function Declarations */
71 | extern const mxArray
72 | *sf_c5_sim1_rlti_varmax_gust2_get_eml_resolved_functions_info(void);
73 |
74 | /* Function Definitions */
75 | extern void sf_c5_sim1_rlti_varmax_gust2_get_check_sum(mxArray *plhs[]);
76 | extern void c5_sim1_rlti_varmax_gust2_method_dispatcher(SimStruct *S, int_T
77 | method, void *data);
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/c5_sim1_rlti_varmax_gust2.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/c5_sim1_rlti_varmax_gust2.obj
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/rtwtypeschksum.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/rtwtypeschksum.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.bat:
--------------------------------------------------------------------------------
1 | call "mexopts.bat"
2 | nmake -f sim1_rlti_varmax_gust2_sfun.mak
3 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.exp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.exp
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.h:
--------------------------------------------------------------------------------
1 | #ifndef __sim1_rlti_varmax_gust2_sfun_h__
2 | #define __sim1_rlti_varmax_gust2_sfun_h__
3 |
4 | /* Include files */
5 | #define S_FUNCTION_NAME sf_sfun
6 | #include "sfc_sf.h"
7 | #include "sfc_mex.h"
8 | #include "rtwtypes.h"
9 | #include "sfcdebug.h"
10 | #define rtInf (mxGetInf())
11 | #define rtMinusInf (-(mxGetInf()))
12 | #define rtNaN (mxGetNaN())
13 | #define rtIsNaN(X) ((int)mxIsNaN(X))
14 | #define rtIsInf(X) ((int)mxIsInf(X))
15 |
16 | /* Type Definitions */
17 |
18 | /* Named Constants */
19 | #define CALL_EVENT (-1)
20 |
21 | /* Variable Declarations */
22 | extern uint32_T _sim1_rlti_varmax_gust2MachineNumber_;
23 | extern real_T _sfTime_;
24 |
25 | /* Variable Definitions */
26 |
27 | /* Function Declarations */
28 | extern void sim1_rlti_varmax_gust2_initializer(void);
29 | extern void sim1_rlti_varmax_gust2_terminator(void);
30 |
31 | /* Function Definitions */
32 |
33 | /* We load infoStruct for rtw_optimation_info on demand in mdlSetWorkWidths and
34 | free it immediately in mdlStart. Given that this is machine-wide as
35 | opposed to chart specific, we use NULL check to make sure it gets loaded
36 | and unloaded once per machine even though the methods mdlSetWorkWidths/mdlStart
37 | are chart/instance specific. The following methods abstract this out. */
38 | extern mxArray* load_sim1_rlti_varmax_gust2_optimization_info(void);
39 | extern void unload_sim1_rlti_varmax_gust2_optimization_info(void);
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.lib
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.mexw64.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.mol:
--------------------------------------------------------------------------------
1 | c5_sim1_rlti_varmax_gust2.obj
2 | sim1_rlti_varmax_gust2_sfun_registry.obj
3 | sim1_rlti_varmax_gust2_sfun.obj
4 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun.obj
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun_registry.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varmax_gust2/_self/sfun/src/sim1_rlti_varmax_gust2_sfun_registry.obj
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/binfo.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/binfo.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/chart1_RldjQTVqZeaf7bPKMIG6FG.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/chart1_RldjQTVqZeaf7bPKMIG6FG.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/chart1_v2EDslKQ9w9YLzGIbb0pOB.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/info/chart1_v2EDslKQ9w9YLzGIbb0pOB.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/c1_sim1_rlti_varx_fast_gust2.h:
--------------------------------------------------------------------------------
1 | #ifndef __c1_sim1_rlti_varx_fast_gust2_h__
2 | #define __c1_sim1_rlti_varx_fast_gust2_h__
3 |
4 | /* Include files */
5 | #include "sfc_sf.h"
6 | #include "sfc_mex.h"
7 | #include "rtwtypes.h"
8 |
9 | /* Type Definitions */
10 | typedef struct {
11 | const char * context;
12 | const char * name;
13 | const char * dominantType;
14 | const char * resolved;
15 | uint32_T fileTimeLo;
16 | uint32_T fileTimeHi;
17 | uint32_T mFileTimeLo;
18 | uint32_T mFileTimeHi;
19 | } c1_ResolvedFunctionInfo;
20 |
21 | typedef struct {
22 | SimStruct *S;
23 | real_T c1_ABK[70];
24 | real_T c1_CD[16];
25 | real_T c1_Du;
26 | real_T c1_Dy[4];
27 | real_T c1_Glk[459];
28 | real_T c1_LK[15000];
29 | real_T c1_Pabk[100];
30 | real_T c1_Pcd[64];
31 | real_T c1_Plk[1099];
32 | real_T c1_U1;
33 | real_T c1_VARX[306];
34 | real_T c1_VARX1[300];
35 | real_T c1_W[700];
36 | real_T c1_X[7];
37 | real_T c1_X1[7];
38 | real_T c1_Y1[2];
39 | real_T c1_Ylk[3];
40 | real_T c1_Z[156];
41 | real_T c1_eta[468];
42 | real_T c1_k;
43 | real_T c1_saw;
44 | real_T c1_start;
45 | real_T c1_w[300];
46 | boolean_T c1_ABK_not_empty;
47 | boolean_T c1_CD_not_empty;
48 | boolean_T c1_Glk_not_empty;
49 | boolean_T c1_LK_not_empty;
50 | boolean_T c1_Pabk_not_empty;
51 | boolean_T c1_Pcd_not_empty;
52 | boolean_T c1_Plk_not_empty;
53 | boolean_T c1_U1_not_empty;
54 | boolean_T c1_VARX1_not_empty;
55 | boolean_T c1_VARX_not_empty;
56 | boolean_T c1_X1_not_empty;
57 | boolean_T c1_X_not_empty;
58 | boolean_T c1_Y1_not_empty;
59 | boolean_T c1_Ylk_not_empty;
60 | boolean_T c1_Z_not_empty;
61 | boolean_T c1_eta_not_empty;
62 | boolean_T c1_k_not_empty;
63 | boolean_T c1_saw_not_empty;
64 | boolean_T c1_start_not_empty;
65 | boolean_T c1_w_not_empty;
66 | uint8_T c1_is_active_c1_sim1_rlti_varx_fast_gust2;
67 | ChartInfoStruct chartInfo;
68 | } SFc1_sim1_rlti_varx_fast_gust2InstanceStruct;
69 |
70 | /* Named Constants */
71 |
72 | /* Variable Declarations */
73 |
74 | /* Variable Definitions */
75 |
76 | /* Function Declarations */
77 | extern const mxArray
78 | *sf_c1_sim1_rlti_varx_fast_gust2_get_eml_resolved_functions_info(void);
79 |
80 | /* Function Definitions */
81 | extern void sf_c1_sim1_rlti_varx_fast_gust2_get_check_sum(mxArray *plhs[]);
82 | extern void c1_sim1_rlti_varx_fast_gust2_method_dispatcher(SimStruct *S, int_T
83 | method, void *data);
84 |
85 | #endif
86 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/c1_sim1_rlti_varx_fast_gust2.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/c1_sim1_rlti_varx_fast_gust2.obj
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/rtwtypeschksum.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/rtwtypeschksum.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.bat:
--------------------------------------------------------------------------------
1 | call "mexopts.bat"
2 | nmake -f sim1_rlti_varx_fast_gust2_sfun.mak
3 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.exp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.exp
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.h:
--------------------------------------------------------------------------------
1 | #ifndef __sim1_rlti_varx_fast_gust2_sfun_h__
2 | #define __sim1_rlti_varx_fast_gust2_sfun_h__
3 |
4 | /* Include files */
5 | #define S_FUNCTION_NAME sf_sfun
6 | #include "sfc_sf.h"
7 | #include "sfc_mex.h"
8 | #include "rtwtypes.h"
9 | #include "sfcdebug.h"
10 | #define rtInf (mxGetInf())
11 | #define rtMinusInf (-(mxGetInf()))
12 | #define rtNaN (mxGetNaN())
13 | #define rtIsNaN(X) ((int)mxIsNaN(X))
14 | #define rtIsInf(X) ((int)mxIsInf(X))
15 |
16 | /* Type Definitions */
17 |
18 | /* Named Constants */
19 | #define CALL_EVENT (-1)
20 |
21 | /* Variable Declarations */
22 | extern uint32_T _sim1_rlti_varx_fast_gust2MachineNumber_;
23 | extern real_T _sfTime_;
24 |
25 | /* Variable Definitions */
26 |
27 | /* Function Declarations */
28 | extern void sim1_rlti_varx_fast_gust2_initializer(void);
29 | extern void sim1_rlti_varx_fast_gust2_terminator(void);
30 |
31 | /* Function Definitions */
32 |
33 | /* We load infoStruct for rtw_optimation_info on demand in mdlSetWorkWidths and
34 | free it immediately in mdlStart. Given that this is machine-wide as
35 | opposed to chart specific, we use NULL check to make sure it gets loaded
36 | and unloaded once per machine even though the methods mdlSetWorkWidths/mdlStart
37 | are chart/instance specific. The following methods abstract this out. */
38 | extern mxArray* load_sim1_rlti_varx_fast_gust2_optimization_info(void);
39 | extern void unload_sim1_rlti_varx_fast_gust2_optimization_info(void);
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.lib
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.mexw64.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.mol:
--------------------------------------------------------------------------------
1 | c1_sim1_rlti_varx_fast_gust2.obj
2 | sim1_rlti_varx_fast_gust2_sfun_registry.obj
3 | sim1_rlti_varx_fast_gust2_sfun.obj
4 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun.obj
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun_registry.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_fast_gust2/_self/sfun/src/sim1_rlti_varx_fast_gust2_sfun_registry.obj
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/binfo.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/binfo.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/chart2_ABX9sv2Fuqtg24DYMjDvvF.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/chart2_ABX9sv2Fuqtg24DYMjDvvF.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/chart2_sqMHCYEULCklBR6f1VisPC.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/info/chart2_sqMHCYEULCklBR6f1VisPC.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/c2_sim1_rlti_varx_gust2.h:
--------------------------------------------------------------------------------
1 | #ifndef __c2_sim1_rlti_varx_gust2_h__
2 | #define __c2_sim1_rlti_varx_gust2_h__
3 |
4 | /* Include files */
5 | #include "sfc_sf.h"
6 | #include "sfc_mex.h"
7 | #include "rtwtypes.h"
8 |
9 | /* Type Definitions */
10 | typedef struct {
11 | const char * context;
12 | const char * name;
13 | const char * dominantType;
14 | const char * resolved;
15 | uint32_T fileTimeLo;
16 | uint32_T fileTimeHi;
17 | uint32_T mFileTimeLo;
18 | uint32_T mFileTimeHi;
19 | } c2_ResolvedFunctionInfo;
20 |
21 | typedef struct {
22 | SimStruct *S;
23 | real_T c2_ABK[70];
24 | real_T c2_CD[16];
25 | real_T c2_Du;
26 | real_T c2_Dy[4];
27 | real_T c2_LK[15000];
28 | real_T c2_Pabk[100];
29 | real_T c2_Pcd[64];
30 | real_T c2_Plk[23104];
31 | real_T c2_U1;
32 | real_T c2_VARX[304];
33 | real_T c2_W[700];
34 | real_T c2_X[7];
35 | real_T c2_X1[7];
36 | real_T c2_Y1[2];
37 | real_T c2_Zp[150];
38 | real_T c2_k;
39 | real_T c2_saw;
40 | real_T c2_start;
41 | real_T c2_w[300];
42 | boolean_T c2_ABK_not_empty;
43 | boolean_T c2_CD_not_empty;
44 | boolean_T c2_LK_not_empty;
45 | boolean_T c2_Pabk_not_empty;
46 | boolean_T c2_Pcd_not_empty;
47 | boolean_T c2_Plk_not_empty;
48 | boolean_T c2_U1_not_empty;
49 | boolean_T c2_VARX_not_empty;
50 | boolean_T c2_X1_not_empty;
51 | boolean_T c2_X_not_empty;
52 | boolean_T c2_Y1_not_empty;
53 | boolean_T c2_Zp_not_empty;
54 | boolean_T c2_k_not_empty;
55 | boolean_T c2_saw_not_empty;
56 | boolean_T c2_start_not_empty;
57 | boolean_T c2_w_not_empty;
58 | uint8_T c2_is_active_c2_sim1_rlti_varx_gust2;
59 | ChartInfoStruct chartInfo;
60 | } SFc2_sim1_rlti_varx_gust2InstanceStruct;
61 |
62 | /* Named Constants */
63 |
64 | /* Variable Declarations */
65 |
66 | /* Variable Definitions */
67 |
68 | /* Function Declarations */
69 | extern const mxArray *sf_c2_sim1_rlti_varx_gust2_get_eml_resolved_functions_info
70 | (void);
71 |
72 | /* Function Definitions */
73 | extern void sf_c2_sim1_rlti_varx_gust2_get_check_sum(mxArray *plhs[]);
74 | extern void c2_sim1_rlti_varx_gust2_method_dispatcher(SimStruct *S, int_T method,
75 | void *data);
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/c2_sim1_rlti_varx_gust2.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/c2_sim1_rlti_varx_gust2.obj
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/rtwtypeschksum.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/rtwtypeschksum.mat
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.bat:
--------------------------------------------------------------------------------
1 | call "mexopts.bat"
2 | nmake -f sim1_rlti_varx_gust2_sfun.mak
3 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.exp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.exp
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.h:
--------------------------------------------------------------------------------
1 | #ifndef __sim1_rlti_varx_gust2_sfun_h__
2 | #define __sim1_rlti_varx_gust2_sfun_h__
3 |
4 | /* Include files */
5 | #define S_FUNCTION_NAME sf_sfun
6 | #include "sfc_sf.h"
7 | #include "sfc_mex.h"
8 | #include "rtwtypes.h"
9 | #include "sfcdebug.h"
10 | #define rtInf (mxGetInf())
11 | #define rtMinusInf (-(mxGetInf()))
12 | #define rtNaN (mxGetNaN())
13 | #define rtIsNaN(X) ((int)mxIsNaN(X))
14 | #define rtIsInf(X) ((int)mxIsInf(X))
15 |
16 | /* Type Definitions */
17 |
18 | /* Named Constants */
19 | #define CALL_EVENT (-1)
20 |
21 | /* Variable Declarations */
22 | extern uint32_T _sim1_rlti_varx_gust2MachineNumber_;
23 | extern real_T _sfTime_;
24 |
25 | /* Variable Definitions */
26 |
27 | /* Function Declarations */
28 | extern void sim1_rlti_varx_gust2_initializer(void);
29 | extern void sim1_rlti_varx_gust2_terminator(void);
30 |
31 | /* Function Definitions */
32 |
33 | /* We load infoStruct for rtw_optimation_info on demand in mdlSetWorkWidths and
34 | free it immediately in mdlStart. Given that this is machine-wide as
35 | opposed to chart specific, we use NULL check to make sure it gets loaded
36 | and unloaded once per machine even though the methods mdlSetWorkWidths/mdlStart
37 | are chart/instance specific. The following methods abstract this out. */
38 | extern mxArray* load_sim1_rlti_varx_gust2_optimization_info(void);
39 | extern void unload_sim1_rlti_varx_gust2_optimization_info(void);
40 |
41 | #endif
42 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.lib
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.mexw64.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.mol:
--------------------------------------------------------------------------------
1 | c2_sim1_rlti_varx_gust2.obj
2 | sim1_rlti_varx_gust2_sfun_registry.obj
3 | sim1_rlti_varx_gust2_sfun.obj
4 |
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun.obj
--------------------------------------------------------------------------------
/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun_registry.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/TUDelft-DataDrivenControl/Predictor-Based-Subspace-IDentification-toolbox/b96f26296442f67f0303730e869601a7a923dd9d/simulink/slprj/_sfprj/sim1_rlti_varx_gust2/_self/sfun/src/sim1_rlti_varx_gust2_sfun_registry.obj
--------------------------------------------------------------------------------
/simulink/xpc1_h2_ctrl.m:
--------------------------------------------------------------------------------
1 | % Identification of 2D Airfoil
2 | clc; clear; close all;
3 |
4 | % High frequency roll-off filter
5 | omega=10*pi*2;
6 | filter = tf([omega^2],[1 omega*2*0.5 omega^2]);
7 |
8 | % Load Data
9 | load model.mat
10 | P = ss(Mi);
11 | P = d2c(P);
12 | P = series([filter 0 0; 0 1 0; 0 0 1],P);
13 | figure, bodemag(P);
14 | figure, sigma(P);
15 |
16 | % H2 design
17 | GP = [P; 0.01 0 0];
18 | GP = minreal(GP([1:3 1:2],[2:3 1]));
19 | [C,CL,gam,info] = h2syn(GP,2,1);
20 | gam
21 | figure, bodemag(C);
22 | figure, sigma(C);
23 |
24 | % disturbance
25 | t = (0:0.01:10)';
26 | u1 = [5*sin(t.*4.7) 5*sin(t.*4.7)];
27 | u2 = [5*sin(t.*17.1) 5*sin(t.*17.1+pi)];
28 |
29 | % Rescale;
30 | H = P(1:2,2:3);
31 | P = P(1:2,1);
32 |
33 | % Closed-loop
34 | CL = feedback(P,C,+1);
35 | figure, pzmap(CL);
36 | figure, bodemag(CL);
37 | figure, sigma(CL);
38 |
39 | % Sensitivity function
40 | S = minreal(inv(eye(2) - P*C));
41 | figure, bodemag(S);
42 | figure, sigma(S);
43 | figure, lsim(S,u1,t);
44 | figure, lsim(S,u2,t);
45 |
46 | % Noise Sensitivity function
47 | N = minreal(inv(eye(2) - P*C))*H;
48 | figure, bodemag(N,H);
49 | figure, sigma(N,H);
50 |
51 | % Input Sensitivity function
52 | I = minreal(inv(1 - C*P))*C;
53 | figure, bodemag(I);
54 | figure, sigma(I);
55 | figure, lsim(I,u1,t);
56 | figure, lsim(I,u2,t);
57 |
58 | % resample
59 | Ts = 0.005;
60 | Fs = c2d(filter,Ts,'tustin');
61 | Cs = c2d(C,Ts,'tustin');
62 | figure, bodemag(C*filter,Cs*Fs);
63 |
64 | % save controller
65 | save h2ctrl.mat Fs Cs
66 |
67 | % State-feedback regulator design for antiwindup
68 | O = ss(Cs.a',Cs.c',Cs.b',Cs.d',Cs.ts);
69 | Q = eye(2);
70 | R = 100;
71 | [L,S,E] = lqry(O,Q,R);
72 | L = L';
73 | Cs = ss(Cs.a,[Cs.b L],Cs.c,[Cs.d 0],Cs.ts);
74 |
75 | % save controller
76 | save h2ctrl_aw.mat Fs Cs
77 |
--------------------------------------------------------------------------------
/snr.m:
--------------------------------------------------------------------------------
1 | function s = snr(y,y0)
2 | %SNR Signal to noise ratio [dB]
3 | % S = SNR(Y,Y0) calculates the Signal to Noise Ratio (SNR) of the signals
4 | % Y and Y0, where Y is the noise corrupted output of the system and Y0 the
5 | % output of the deterministic transfer only.
6 |
7 | % Ivo Houtzager
8 | % Delft Center of Systems and Control
9 | % Delft University of Technology
10 | % The Netherlands, 2010
11 |
12 |
13 | % check input arguments
14 | if nargin ~= 2
15 | error('SNR requires two input arguments!')
16 | end
17 |
18 | % check dimensions of inputs
19 | if size(y,2) > size(y,1)
20 | y = y';
21 | end
22 | if size(y0,2) > size(y0,1)
23 | y0 = y0';
24 | end
25 | N = size(y,1);
26 | if size(y0,1) ~= N
27 | error('Both signals should have an equal number of samples.');
28 | end
29 | if size(y,2) ~= size(y0,2)
30 | error('Both signals should have an equal number of components.');
31 | end
32 |
33 | % calculate signal to noise ratio
34 | s = 10*log10(var(y)./var(y-y0));
--------------------------------------------------------------------------------
/vaf.m:
--------------------------------------------------------------------------------
1 | function v = vaf(y,y_est)
2 | %VAF Variance Accounted For [%]
3 | % V = VAF(Y,Yest) computes the percentage of the Variance Accounted For
4 | % (VAF) between the two signals Y and Yest. The VAF is calculated as:
5 | %
6 | % variance(y-y_est)
7 | % v = max( 1 - ----------------- , 0 ) * 100%
8 | % variance(y)
9 | %
10 | % The VAF of two signals that are the same is 100%. If they differ, the
11 | % VAF will be lower. When Y and Yest have multiple columns, the VAF is
12 | % calculated for every column in Y and Yest. The VAF is often used to
13 | % verify the correctness of a stable model, by comparing the real output
14 | % with the estimated output of the stable model.
15 | %
16 | % See also PEC, FIT.
17 |
18 | % Ivo Houtzager
19 | % Delft Center of Systems and Control
20 | % Delft University of Technology
21 | % The Netherlands, 2010
22 |
23 | % check input arguments
24 | if nargin < 2
25 | error('VAF requires two input arguments!');
26 | end
27 |
28 | % check dimensions of inputs
29 | if size(y,2) > size(y,1)
30 | y = y';
31 | end
32 | if size(y_est,2) > size(y_est,1)
33 | y_est = y_est';
34 | end
35 | N = size(y,1);
36 | if size(y_est,1) ~= N
37 | error('Both signals should have an equal number of samples.');
38 | end
39 | if size(y,2) ~= size(y_est,2)
40 | error('Both signals should have an equal number of components.');
41 | end
42 |
43 | % calculate the variance accounted for
44 | v = max(diag(100*(eye(size(y,2))-cov(y-y_est)./cov(y))),0);
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/wmodx.m:
--------------------------------------------------------------------------------
1 | function x = wmodx(X,n)
2 | %WMODX Closed-loop Wiener system identification using the PBSIDopt method.
3 | % x=wmodx(X,n) estimates the state sequence x of the identifiable system
4 | % with order n. The order n can be determined from the singular values
5 | % given by wordvarx. The matrix X is also calculated by wordvarx.
6 | %
7 | % See also: wordvarx, wx2abcdk.m, and wx2abck.m.
8 | %
9 | % References:
10 | % [1] J.W. van Wingerden, and M. Verhaegen, ``Closed-loop subspace
11 | % identification of Hammerstein-Wiener models'', Joint 48th IEEE
12 | % Conference on Decision and Control and 28th Chinese Control Conference
13 | % Shanghai, P.R. China, December 16-18, 2009.
14 |
15 | % Ivo Houtzager
16 | % Delft Center of Systems and Control
17 | % Delft University of Technology
18 | % The Netherlands, 2010
19 |
20 | % check number of arguments
21 | if nargin < 2
22 | error('DMODX requires at least two input arguments.');
23 | end
24 |
25 | % cheack the dimensions of the inputs
26 | mx = size(X,1);
27 | if (n < 1) || isempty(n)
28 | error('System order of zero or lower does not make sense!')
29 | end
30 | if mx < n
31 | error('The number of rows of matrix X must be equal or higher then the order n.')
32 | end
33 |
34 | x = X(1:n,:);
35 |
36 | % scale the state sequence
37 | %x = diag(1./sqrt(var(x,0,2)))*x;
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------