フィルターのクリア

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 Center および File ExchangePSK についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by