Error using nrPolarEncode Expected IN to be binary.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
K = 512; % Message length
N = 1024; % Code length
SNR = 2; % Signal-to-Noise Ratio (dB)
% Generate a random message bit sequence
message_binary = logical(randi([0 1], K, 1));
% Encode the message using a polar code
encoder = nError using nrPolarEncode
Expected IN to be binary.rPolarEncode(N,K);
codedBits = encoder(message_binary);
% Add AWGN noise to the coded bits
noisyCodedBits = awgn(codedBits,SNR,'measured');
% Decode the noisy coded bits using a polar code
decoder = nrPolarDecode(N,K);
decodedBits = decoder(noisyCodedBits);
% Compute the bit error rate
ber = sum(xor(message_binary,decodedBits))/K;
% Display the results
disp(['Message Length: ' num2str(K)]);
disp(['Code Length: ' num2str(N)]);
disp(['SNR: ' num2str(SNR) ' dB']);
disp(['Bit Error Rate: ' num2str(ber)]);
0 comentarios
Respuestas (1)
Nihal Reddy
el 13 de Abr. de 2023
I understand you are facing an error while using the "nrPolarEncode" function.
The syntax for the "nrPolarEncode" function is as follows-
enc = nrPolarEncode(in,E)
The function takes input arguments 'in' which is Input message, specified as a column vector of binary values and 'E' which is Rate-matched output length in bits, specified as a positive integer and returns the polar-encoded output for the input message in and rate-matched output length E.
In your case 'in' input argument is variable 'N' which is not a column vector of binary values that is the reason the error is being thrown. Please ensure that a column vector of binary values is used for 'in' input argument to "nrPolarEncode" function.
Refer to the following MATLAB documentation for more information-
0 comentarios
Ver también
Categorías
Más información sobre Wireless Communications en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!