Empirical ber must be a real vector between 0 and 1
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
When i use a line berfit(EbNoEncoderInput, BERVec(1,:)); i got a error like EMPBer must a real vector between 0 and 1
Réponses (1)
Ayush
le 3 Jan 2024
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 commentaires
Voir également
Catégories
En savoir plus sur Test and Measurement dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!