Error using nrPolarEncode Expected IN to be binary.
조회 수: 2 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Nihal Reddy
2023년 4월 13일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Bessel functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!