问题描述
您好,谁能告诉我们如何将modem.oqpskmod用于BER.谢谢!
hi can anyone show how to use the modem.oqpskmod for BER. thanks!
h = modem.oqpskmod
y = modulate(h, values);
g = modem.oqpskdemod(h)
z = demodulate(g, y)
让我们假设我有一个名为value的数组,其中只包含1和0.我的问题是我将如何计算误码率?当然如果上面的代码是正确的.
let's assume that i have array called values which contains only 1s and 0s.my question is how would i calculate BER? of course if above my code is correct.
推荐答案
基于此维基百科页面,您只需计算不正确的位数,然后除以传输的位数,即可得出误码率(BER).如果values
是未经调制的输入信号,而z
是经过调制和解调后的输出信号,则可以这样计算:
Based on this Wikipedia page, you simply have to compute the number of incorrect bits and divide by the total number of transferred bits to get the bit error rate (BER). If values
is the unmodulated input signal and z
is the output signal after modulation and demodulation, you can compute it like this:
BER = sum(logical(values(:)-z(:)))/numel(values);
编辑:我修改了上面的代码,以防万一您遇到两种情况:
I modified the above code just in case you run into two situations:
- 如果
z
的值不是0和1. - 如果
z
的大小与values
的大小不同(即行向量与列向量).
- If
z
has values other than 0 and 1. - If
z
is a different size thanvalues
(i.e. row vector versus column vector).
我不知道您是否曾经遇到过这两种情况,但是安全胜过遗憾. ;)
I don't know if you are ever likely to come across these two situations, but better safe than sorry. ;)
这篇关于BER的modem.oqpskmod的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!