Get specific data from if condition

1 vue (au cours des 30 derniers jours)
Ibnu Darajat
Ibnu Darajat le 19 Déc 2023
Here is the code for BPSK modulation and demodulation:
bpskModulator = comm.BPSKModulator;
bpskDemodulator = comm.BPSKDemodulator;
errorRate = comm.ErrorRate;
awgnChannel = comm.AWGNChannel('BitsPerSymbol',1);
ebnoVec = 5:10; % Eb/No range
berBPSK = zeros(size(ebnoVec));
for n = 1:length(ebnoVec)
% Reset the error counter for each Eb/No value
reset(errorRate)
% Reset the array used to collect the error statistics
errVec = [0 0 0];
% Set the channel Eb/No
awgnChannel.EbNo = ebnoVec(n);
while errVec(2) < 200 && errVec(3) < 1e7
% Generate a 1000-symbol frame
data = double(codeword);
% Modulate the binary data
modData = bpskModulator(data);
% Pass the modulated data through the AWGN channel
rxSig = awgnChannel(modData);
% Demodulate the received signal
rxData = bpskDemodulator(rxSig);
% Collect the error statistics
errVec = errorRate(data,rxData);
end
% Save the BER data
my question is, How do I get the value of rxData if the eb/no value is 6?

Réponses (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov le 19 Déc 2023
If understood correctly, here is how to get it:
...
for n = 1:length(ebnoVec)
% Reset the error counter for each Eb/No value
reset(errorRate)
% Reset the array used to collect the error statistics
errVec = [0 0 0];
% Set the channel Eb/No
awgnChannel.EbNo = ebnoVec(n);
while errVec(2) < 200 && errVec(3) < 1e7
% Generate a 1000-symbol frame
data = double(codeword);
% Modulate the binary data
modData = bpskModulator(data);
% Pass the modulated data through the AWGN channel
rxSig = awgnChannel(modData);
% Demodulate the received signal
rxData = bpskDemodulator(rxSig);
% Collect the error statistics
errVec = errorRate(data,rxData);
end
% Here is how to get the value (s) of rxData:
if n==2
D_ebno6=rxData; % Stored under this variable
% disp(rxData)
end
% Save the BER data
end

Catégories

En savoir plus sur Propagation and Channel Models dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by