 function Z_new = refine(Z_old,N_panels)
%
%  Z_old is a matrix wherein each column is the
%  augmented [control(:); state(:)] on a particular
%  time-panel. This routine generates Z_new with twice
%  as many columns. Each column of Z_old is duplicated
%  as two columns of Z_new. This is a crude lifting
% to a finer grid with twice as many time panels
%
  m = length(Z_old)/N_panels;
  tmp = reshape(Z_old,m,N_panels);
  Z_new = zeros(m,2*N_panels);
%
 for j=1:N_panels
   Z_new(:, 2*(j-1) + 1) = tmp(:,j);
   Z_new(:, 2*(j-1) + 2) = tmp(:,j);
 end
%
 Z_new = Z_new(:);
%
% return
%
