error with 8psk modulation

조회 수: 2 (최근 30일)
hela gout
hela gout 2014년 12월 25일
답변: Rick Rosson 2014년 12월 30일
Hi, I'am trying to test a code of the 8PSK modulation,this is the code:
custMap = [0 2 4 6 7 5 3 1];
hMod = comm.PSKModulator(8,'BitInput',true,'SymbolMapping','Custom','CustomSymbolMapping',custMap);
hDemod = comm.PSKDemodulator(8,'BitOutput',true,'SymbolMapping','Custom','CustomSymbolMapping',custMap);
% Display the modulator constellation.
constellation(hMod)
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;
ber = zeros(size(ebnoVec));
for k = 1:length(ebnoVec)
% Reset the error counter for each Eb/No value
reset(hErr)
% Reset the array used to collect the error statistics
errVec = [0 0 0];
% 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);
% Modulate the binary data
modData = step(hMod,data);
% Pass the modulated data through the AWGN channel
rxSig = step(hChan,modData);
% Demodulate the received signal
rxData = step(hDemod,rxSig);
% Collect the error statistics
errVec = step(hErr,data,rxData);
end
% Save the BER data
ber(k) = errVec(1);
end
berTheory = berawgn(ebnoVec,'psk',8,'nondiff');
figure
semilogy(ebnoVec,[ber; berTheory])
xlabel('Eb/No (dB)')
ylabel('BER')
grid
legend('Simulation','Theory','location','ne')
but I have a problem at this line
modData = step(hMod,data);
this is the error:
how can I solve the problem pleaze and thanks

답변 (1개)

Rick Rosson
Rick Rosson 2014년 12월 30일
Instead of
data = randi([0 1],4000,1);
please try
data = randi([0 1],3000,1);

카테고리

Help CenterFile Exchange에서 PSK에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by