function [Matricesf Matricesr] = matrices_controllers(nfull,nred)

% set up controllers
umax  = 1; umin = -1;
N     = 8; nu = 2;
[Gfull] = model_baltrunc(nfull);
[Gred Tl Tr] = baltrunc(Gfull,nred);
% make a discrete-time approximation
Ts	= 1;
Gfull = c2d(Gfull,Ts);
Gred = c2d(Gred,Ts);

%% make the MPC controllers
[Af Bf Cf] = deal(Gfull.a,Gfull.b(:,1:2),Gfull.c);
[Ar Br Cr] = deal(Gred.a,Gred.b(:,1:2),Gred.c);	% we ignore the D-term!

[HHf Sf] = create_CHS(Af,Bf,Cf,N);
[HHr Sr] = create_CHS(Ar,Br,Cr,N);

% define matrices for MPC
% 1: full controller
Hf = Sf'*Sf + eye(nu*N);
Ff = HHf'*Sf;
Wf = [ones(nu*N,1)*umax; ones(nu*N,1)*(-umin)];
Gf = [eye(nu*N);-eye(nu*N)];
% 2: reduced controller
Hr = Sr'*Sr + eye(nu*N);
Fr = HHr'*Sr;
Wr = [ones(nu*N,1)*umax; ones(nu*N,1)*(-umin)];
Gr = [eye(nu*N);-eye(nu*N)];

Matricesf.H = Hf;
Matricesf.F = Ff;
Matricesf.W = Wf;
Matricesf.G = Gf;
Matricesf.E = zeros(nu*N*2,nfull);

Matricesr.H = Hr;
Matricesr.F = Fr;
Matricesr.W = Wr;
Matricesr.G = Gr;
Matricesr.E = zeros(nu*N*2,nred);

