% get_A( b) - create LLSQ data coefficient matrix for x4 problem
%
function A = get_A( b)

global N;
global Memory;

global zstate;
global zstate_0;
global states;

A = zeros( N, Memory+1);

% old:
% ex = [zeros(Memory,1); b];
%
% fixed 9 April 2000 to use zstate instead of zeros
%
% Note: doesn't handle zstate <= 0
%
if( zstate_0)           % initial 0's in the channel
 z = zeros(Memory,1);
else
 z = flipud(states(:,zstate));
end

ex = [z; b];

for i=1:Memory+1
  A(:,i) = ex( [1:N] + (Memory-i+1));
end
