我需要使用矩形 16QAM 调制方案生成一个包含 0 到 15 的 40320 个整数的随机数字消息的输入信号,至少有 101 个错误,以确定误码率。
如何在 Matlab 中实现这一点?到目前为止,我已经编写了这段代码。任何人都可以启发我吗?
M=16; %signal constellation size
log2M =log2(M); %number of bits per symbol
N= 40320; %No of random integers sent
coderate =1;% FEC not required
MinNoErr =101; %Minimum no of received symbol error
MaxNoErr =11e9; %Maximum no of received symbol error
nsamp =1; %No of samples per symbol
B= randi([1, M-1],N,1); % Random integer data stream
% Modulate
hMod = comm.RectangularQAMModulator(M); % Create a 16-QAM modulator
txqam = modulate(modem.qammod(M),B);% Modulate using 16-QAM.
txqam =T; %transmited signal
% Send signal over an AWGN channel
EbNo = [5:1:15]; % In dB
SNR = EbNo + 10*log10(log2M*coderate) - 10*log10(nsamp);
hChan = comm.AWGNChannel('NoiseMethod', 'Signal to noise ratio (SNR)', ...
'SNR',SNR);
hChan.SignalPower = (T' * T)/ length(T);
ynoisy = step(hChan,T);