%
% OFDM file based rx.
+#{
+ TODO:
+ [ ] some sort of real time GUI display to watch signal evolving
+ [ ] est SNR or Eb/No of recieved signal
+ [ ] way to fall out of sync
+#}
function ofdm_rx(filename)
ofdm_lib;
% load real samples from file
- Ascale= 4E5;
+ Ascale= 2E5;
frx=fopen(filename,"rb"); rx = 2*fread(frx, Inf, "short")/4E5; fclose(frx);
Nsam = length(rx); Nframes = floor(Nsam/Nsamperframe);
prx = 1;
% 'prime' rx buf to get correct coarse timing (for now)
prx = 1;
- %nin = Nsamperframe+2*(M+Ncp);
- nin = Nsamperframe+M+Ncp;
+ nin = Nsamperframe+2*(M+Ncp);
states.rxbuf(Nrxbuf-nin+1:Nrxbuf) = rx(prx:nin);
prx += nin;
[ ] maybe 10s worth of frames, sync up to any one automatically
+ or start with maybe 10 frames
+ measure BER match on each one
+ [ ] model clipping/PA compression
+ [ ] sample clock offsets
+ [ ] compare with same SNR from pathsim
#}
function ofdm_tx(filename, Nsec, EbNodB=100, channel='awgn', freq_offset_Hz=0)
rx = real(rx) + noise;
printf("measured SNR: %3.2f dB\n", 10*log10(var(real(tx))/var(noise)));
- Ascale = 4E5;
+ Ascale = 2E5;
frx=fopen(filename,"wb"); fwrite(frx, Ascale*rx, "short"); fclose(frx);
endfunction