function sys = delay_model( n, theta, zeta, tau )
%
% PURPOSE:
%
% To construct the realization matrices of the delay model in [1] given by
%
% Ex'(t) = A_0x(t) + A_1x(t - tau) + Bu(t), y(t) = Cx(t),
%
% where
%
% E = theta*eye(n) + T, where T has all ones on the subdiagonal and
% superdiagonal,
% A_0 = 1/tau*(1/zeta + 1)*(T - theta*eye(n)),
% A_1 = 1/tau*(1/zeta - 1)*(T - theta*eye(n)), (1)
% B = e_1 + e_2, where e_i is the i-th unit vector of length n,
% C = B'.
%
% ARGUMENTS:
%
% Inputs:
%
% n : order of the system.
% theta,
% zeta,
% tau : parameters of the system.
%
% Outputs:
%
% sys : Struct containing the structural information of the system.
% sys.A : = { A_0, A_1 }, where A_0 and A_1 are as in
% (1),
% sys.B : = B as in (1),
% sys.C : = C as in (1),
% sys.D : = 0,
% sys.E : = E as in (1),
% sys.fct.type : = 'd' (delay model),
% sys.fct.a, : = [0 tau].
%
% REFERENCES:
%
% [1] C. Beattie and S. Gugercin. Interpolatory projection methds for
% structure-preserving model reduction, Systems Control Lett.,
% 58:225-232, 2009.
%
% AUTHORS:
%
% Matthias Voigt, Technische Universitaet Berlin, Institut fuer Mathematik,
% Berlin, Germany.
%
% 24/04/2017.
%
% REVISIONS:
%
% -
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% LINORM_SUBSP 1.0 Copyright (C) 2017 Nicat Aliyev, Emre Mengi,
% Paul Schwerdtner, Matthias Voigt
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see .
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%% CONSTRUCT THE DATA.
%
d = ones( n, 3 );
d( 2:end-1 , 2 ) = 0;
T = spdiags( d, [ -1, 0, 1 ], n, n );
E = theta*speye( n ) + T;
A0 = ( 1/tau )*( 1/zeta+1 )*( T - theta*speye( n ) );
A1 = ( 1/tau )*( 1/zeta-1 )*( T - theta*speye( n ) );
B = zeros( n, 1 );
B( 1:2 ) = 1;
B = sparse( B );
C = B';
D = 0;
%
% Copy the data to sys.
%
sys.A = { A0, A1 };
sys.B = B;
sys.C = C;
sys.D = D;
sys.E = E;
sys.fct.type = 'd';
sys.fct.a = [ 0, tau ];
%
return