Advertisement
makispaiktis

Course 1 - Ideal channel (16 QAM)

Aug 23rd, 2023 (edited)
972
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.57 KB | None | 0 0
  1. clear all
  2. close all
  3. clc
  4.  
  5. % 1. 20.000 bits in transmitter
  6. srcBits = randi([0, 1], 20000, 1);
  7.  
  8. % 2. 4 bits per symbol (16 QAM)
  9. modOrder = 16;
  10.  
  11. % 3. QAM Modulation ---> 5000 symbols with 4 bits
  12. modOut = qammod(srcBits, modOrder, "InputType", "bit")
  13.  
  14. % 4. Plot the constellation
  15. scatterplot(modOut)
  16.  
  17. % 5. Ideal Channel
  18. chanOut = modOut;
  19.  
  20. % 6. QAM Demodulation ---> 20.000 bits output
  21. demodOut = qamdemod(chanOut, modOrder, "OutputType", "bit");
  22. size(demodOut)
  23.  
  24. % 7. Check if the received bits are identical to the transmitted ones
  25. check = isequal(srcBits, demodOut)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement