Advertisement
makispaiktis

Course 7 - OFDM with IFFT

Aug 25th, 2023
983
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.88 KB | None | 0 0
  1. clear all
  2. close all
  3. clc
  4.  
  5. % 1. SImulation parameters
  6. numBits = 32768;  % power of 2, to optimize performance of fft/ifft
  7. modOrder = 16;    % for 16-QAM
  8. srcBits = randi([0,1],numBits,1);
  9. qamModOut = qammod(srcBits,modOrder,"InputType","bit","UnitAveragePower",true);
  10. scatterplot(qamModOut)
  11. title("16-QAM Signal")
  12.  
  13. % 2. No filter now - OFDM implementation - IFFT is executed after 16-QAM modulation (instead of filtering)
  14. ofdmModOut = ifft(qamModOut)
  15.  
  16. % 3. AWGN channel
  17. SNR = 15;
  18. chanOut = awgn(ofdmModOut,SNR,"measured");
  19.  
  20. % 4. No filtering again - FFT is executed to decode the signal from the multiple sub-carriers
  21. ofdmDemodOut = fft(chanOut)
  22. scatterplot(ofdmDemodOut)
  23.  
  24. % 5. 16-QAM Demodulation and BER calculation
  25. qamDemodOut = qamdemod(ofdmDemodOut,modOrder,"OutputType","bit","UnitAveragePower",true);
  26. numBitErrors = nnz(srcBits~=qamDemodOut)
  27. BER = numBitErrors/numBits
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement