Empirical ber must be a real vector between 0 and 1
조회 수: 1 (최근 30일)
이전 댓글 표시
When i use a line berfit(EbNoEncoderInput, BERVec(1,:)); i got a error like EMPBer must a real vector between 0 and 1
답변 (1개)
Ayush
2024년 1월 3일
Hi Sowmika,
I understand that you want to resolve the error stating “EMPBer must be a real vector between 0 and 1”.
First step would be to ensure that “EbNoEncoderInput” is a vector of “Eb/N0” values (the ratio of bit energy to noise power spectral density) in dB and “BERVec(1,:)” is a vector of corresponding BER measurements for the “Eb/N0” values. You can follow below steps to correct the error in your code:
- Check Real Values: Ensure that “BERVec(1,:)” contains only real numbers, not complex numbers.
- Range of Values: Make sure that all the elements in “BERVec(1,:)” are within the range of 0 to 1. BER cannot be negative or greater than 1, as it represents the ratio of the number of incorrect bits to the total number of transmitted bits.
- No “NaNs” or “Infs”: Check for “NaN” (Not a Number) or “Inf” (Infinity) values in your BER vector, which are not valid input for “berfit”.
You can refer the pseudo code below to get an idea on how to implement above suggested methods:
% Check for real numbers
if ~isreal(BERVec(1,:))
error('BERVec must contain only real numbers.');
end
% Check for values within the range [0, 1]
if any(BERVec(1,:) < 0) || any(BERVec(1,:) > 1)
error('BERVec values must be between 0 and 1.');
end
% Check for NaNs or Infs
if any(isnan(BERVec(1,:))) || any(isinf(BERVec(1,:)))
error('BERVec must not contain NaN or Inf values.');
end
% If all checks pass, use berfit
berfit(EbNoEncoderInput, BERVec(1,:));
For more information on “berfit” function you can refer the documentation page given below:
Regards,
Ayush
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Test and Measurement에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!