function C=rctrb2(A,B,L);
% RCTRB  Reversed controllability matrix
%        Return the reversed extended controllability matrix 
%        C_L=[A^{L-1}B ... AB B]
% SYNTAX
%        C_L = rctrb2(A,B,L)
% ON INPUT
% A,B  System matrices.
% L    # of block columns in C_L.
% ON OUTPUT
% C_L  The reversed extended controlability matrix.


[n,nu]=size(B);
C=zeros(n,L*nu);
w=B;

C(:,(L-1)*nu+1:L*nu)=w;
for i=2:L
  w=A*w;
  in=(L-i)*nu;
  C(:,in+1:in+nu)=w;
%  C(:,(L-i)*nu+1:(L-i+1)*nu)=w;        % Not so efficient but easier to read.
end
%
% END RCTRB2

% NOTE: We can spare a few multiplications by computing L*nu once !