www.pudn.com > jaguar2s.zip > genvects.m


function y = genvects(x); 
 
% generate a file IQ data. 
% normalize the incoming data vector to 
% 0 to 2**15-1; 
 
N=size(x,2); 
 
mx=0; 
for i=1:N 
   if (abs(real(x(i))) >  mx | abs(imag(x(i))) > mx) 
      mx=abs(x(i)); 
   end; 
end; 
 
scaler = (2^15-1)/mx; 
 
fid=fopen('test_vec.txt','w'); 
 
for i=1:N 
    fprintf(fid,'%8.0f ',(scaler * real(x(i)))); 
    fprintf(fid,'%8.0f\n',(scaler * imag(x(i)))); 
end; 
 
fclose(fid); 
return;