0

I'am trying to code a 8PSK modulation system,this is the code:

custMap = [0 2 4 6 7 5 3 1];
hChan = comm.AWGNChannel('BitsPerSymbol',log2(8));
hErr = comm.ErrorRate;
% Initialize the simulation vectors. The Eb/No is varied from 0 to 10 dB in
% 1 dB steps.
ebnoVec = 0:10;
for k = 1:length(ebnoVec)
      % Set the channel Eb/No
      hChan.EbNo = ebnoVec(k);
      while errVec(2) < 200 && errVec(3) < 1e7
          % Generate a 1000-symbol frame
          data = randi([0 1],4000,1);
          modData = step(hMod,data);
          % Pass the modulated data through the AWGN channel
          rxSig = step(hChan,modData);
          % Demodulate the received signal
          rxData = step(hDemod,rxSig);
      end

  end

but I have a problem at this line:

modData = step(hMod,data);

this is the error: enter image description here how can I solve the problem please and thanks for any Help

Lina
  • 451
  • 1
  • 8
  • 23

1 Answers1

1

You have configured your communication channel to use 3 bits/symbol. Your error is here:

% Generate a 1000-symbol frame
data = randi([0 1],4000,1);

For 1000 symbols, you must generate 3000 bits.

Daniel
  • 36,610
  • 3
  • 36
  • 69