0
파일에서 비트를 읽고 복잡한 이중으로 변환하려고합니다. 각 숫자는 32 비트 (16 Re 및 16 Im)입니다. 그런 다음 qamdemod를 사용하여 복소수 당 6 비트를 얻고 해당 비트를 새 텍스트 파일에 저장하려고합니다. 나는 그 프로그램을했지만 나는 항상 출력으로 같은 수를 가져옵니다 010011 = 프로그램 50 :64QAM 복조 - 항상 동일한 출력을 얻습니다.
% % Main Algorithm
N=16; %length of one sample
RUNTIME = input('How long you want to run in sec=');
prompt = '0 - for sequentially. 1 - for randomaly =';
n = input(prompt);
x=0;
switch n
case 0
timerID = tic; %# Start a clock and return the timer ID
disp('sequentially');
fid=fopen('rand.bin'); %need to check if file opened
fid_w=fopen('samples.txt','w'); %write to file
while true
%# Perform process
Re=fread(fid,N);
Re=Re'; %transpose to row vector
Im=fread(fid,N);
Im=Im'; %transpose to row vector
if size(Re)~=N
disp('Re is out of range');
break;
end
if size(Im)~=N
disp('Im is out of range');
break;
end
Re_dec=bi2de(Re);
Im_dec=bi2de(Im);
in = (Re_dec/65535) + (Im_dec*(1i)/65535); % unit circle 65535
double(in);
disp("IN:");
disp(in);
out = qamdemod(in,64);
data_out = de2bi(out);
disp(data_out);
fprintf(fid_w,'%f\n',in); %write to sample file
if (feof(fid))
disp('end of file');
break;
end
if(toc(timerID) > RUNTIME) %# Get the elapsed time for the timer
disp('end of time');
break;
end
end
case 1
disp('randomaly')
otherwise
disp('error')
end
fclose('all'); %close all open files
% out = lteSymbolDemodulate(in,'64QAM');