BERtool showing "Too many input arguements"
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dharmik Bhanushali
el 6 de Mayo de 2021
Respondida: Shiva Kalyan Diwakaruni
el 12 de Mayo de 2021
here is the code.On running this fuction code in BERTool/BER Analysis i get some error(read title for the error msg)
function [ber, bits]=WNproj(EbNo, maxNumErrs, maxNumBits)
%% Constants
FRM=2048;
Trellis=poly2trellis(4, [13 15], 13);
Indices=randperm(FRM);
M=4;k=log2(M);
R= FRM/(3* FRM + 4*3);
snr = EbNo + 10*log10(k) + 10*log10(R);
noise_var = 10.^(-snr/10);
%% Initializations
persistent Modulator AWGN DeModulator BitError TurboEncoder TurboDecoder
if isempty(Modulator)
Modulator = comm.QPSKModulator('BitInput',true);
AWGN = comm.AWGNChannel;
DeModulator = comm.QPSKDemodulator('BitOutput',true);
BitError = comm.ErrorRate;
TurboEncoder=comm.TurboEncoder('TrellisStructure',Trellis,'InterleaverIndices',Indices);
TurboDecoder=comm.TurboDecoder('TrellisStructure',Trellis,'InterleaverIndices',Indices,'NumIterations',6);
end
%% Processsing loop modeling transmitter, channel model and receiver
AWGN.EbNo=snr;
numErrs = 0; numBits = 0;results=zeros(3,1);
while ((numErrs < maxNumErrs) && (numBits < maxNumBits))
% Transmitter
u = randi([0 1], FRM,1); % Random bits generator
encoded = TurboEncoder.step(u); % Turbo Encoder
mod_sig = Modulator.step(encoded); % QPSK Modulator
% Channel
rx_sig = AWGN.step(mod_sig); % AWGN channel
% Receiver
demod = DeModulator.step(rx_sig, noise_var); % Soft-decision QPSK Demodulator
decoded = TurboDecoder.step(-demod); % Turbo Decoder
y = decoded(1:FRM); % Compute output bits
results = BitError.step(u, y); % Update BER
numErrs = results(2);
numBits = results(3);
end
%% Clean up & collect results
ber = results(1); bits= results(3);
reset(BitError);
0 comentarios
Respuestas (1)
Shiva Kalyan Diwakaruni
el 12 de Mayo de 2021
Hi,
demod = DeModulator.step(rx_sig, noise_var); uses soft decision demodulation and noise variance VAR. This syntax applies when you set the BitOutput property to true, the DecisionMethod property to Approximate log-likelihood ratio or Log-likelihood ratio, and the VarianceSource property to Input port. The data type of input VAR must be double or single precision.
Hence in your code BitOutput property is set to true but the DecisionMethod property also should be set to Approximate log-likelihood ratio or Log-likelihood ratio, and the VarianceSource property should be set to Input port
Hope it helps.
0 comentarios
Ver también
Categorías
Más información sobre Modulation en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!