www.pudn.com > space-timecodingBrankaVuceticJinhongYuan.rar > form_ref_matrix.m, change:2007-01-15,size:744b


function p=form_ref_matrix(P) 
 
if P==1 
    a=[-1 1]; 
    b=a; 
elseif P==2 
    bits_in=[1 0 1 1 0 1 0 0]; 
    full_len=length(bits_in); 
    % Angle [pi/4 3*pi/4 -3*pi/4 -pi/4] corresponds to  
    % Gray code vector [00 10 11 01], respectively. 
    table=exp(j*[-3/4*pi 3/4*pi 1/4*pi -1/4*pi]);  % generates QPSK symbols 
    table=table([0 1 3 2]+1); % Gray code mapping pattern for QPSK symbols 
    inp=reshape(bits_in,2,full_len/2); 
    mod_symbols=table([2 1]*inp+1);  % maps transmitted bits into QPSK symbols 
   a=mod_symbols; 
   b=a; 
end 
p=[];;    
temp3=[]; 
for i=1:2*P 
    for k=1:2*P 
        temp2=[a(i); b(k)]; 
        temp3=[temp3 temp2]; 
        temp2=[]; 
    end 
        p=[p temp3]; 
        temp3=[]; 
end