调制解调器.oqpskmod -> modem.oqpskdemod 结果不同

发布于 2024-08-22 11:26:07 字数 2673 浏览 8 评论 0原文

我正在尝试模拟 IEEE 802.15.4/ZigBEE PHY,...

   chip_values = [
   1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0;
   1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0;
   0,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0;
   0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1;
   0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1;
   0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0;
   1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1;
   1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1;
   1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1;
   1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1;
   0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1;
   0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0;
   0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0;
   0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1;
   1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0;
   1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0];

   tx = [];
   values = randsrc(1,1,[0:15]);
   for k=1:length(values)
    sym = values(k);
    tx = [tx chip_values((sym+1),1:end)];
   end;

   tx = tx.';
   h = modem.oqpskmod;
   y = modulate(h, tx);
   g = modem.oqpskdemod(h);
   z = demodulate(g, y);
   length(z)
   for k=1:length(tx)
    if(tx(k)~=z(k))
     fprintf('%d %d\n',tx(k),z(k)); 
    end;
   end;

我的问题是在这个简单的情况下,为什么我的 tx 和 z 不包含相同的值,即使我还没有引入任何噪声?谢谢!

tx 的值如下所示:

第 1 列至第 13

 0     1     1     0     0     0     0     0     0     1     1     1     0

列 第 14 至 26

 1     1     1     1     0     1     1     1     0     0     0     1     1

列 第 27 至 32

 0     0     1     0     0     1

列 z 的值如下所示:

第 1 至 13

 3     0     1     1     0     0     0     0     0     0     1     1     1

列 第 14 至 26

 0     1     1     1     1     0     1     1     1     0     0     0     1

列 第 27 至 32 列

 1     0     0     1     0     0


  h =

         Type: 'OQPSK Modulator'
            M: 4
  PhaseOffset: 0
Constellation: [1x4 double]
  SymbolOrder: 'Binary'
SymbolMapping: [0 1 2 3]
    InputType: 'Integer'

  g =

         Type: 'OQPSK Demodulator'
            M: 4
  PhaseOffset: 0
Constellation: [1x4 double]
  SymbolOrder: 'Binary'
SymbolMapping: [0 1 2 3]
   OutputType: 'Integer'
 DecisionType: 'Hard decision'

i am trying to simulate the IEEE 802.15.4/ZigBEE PHY,...

   chip_values = [
   1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0;
   1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0;
   0,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0;
   0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1;
   0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1;
   0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1,1,1,0,0;
   1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1,1,0,0,1;
   1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,1,0,1;
   1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1;
   1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1;
   0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1;
   0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0;
   0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0;
   0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0,1,0,0,1;
   1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,1,1,0,0;
   1,1,0,0,1,0,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0];

   tx = [];
   values = randsrc(1,1,[0:15]);
   for k=1:length(values)
    sym = values(k);
    tx = [tx chip_values((sym+1),1:end)];
   end;

   tx = tx.';
   h = modem.oqpskmod;
   y = modulate(h, tx);
   g = modem.oqpskdemod(h);
   z = demodulate(g, y);
   length(z)
   for k=1:length(tx)
    if(tx(k)~=z(k))
     fprintf('%d %d\n',tx(k),z(k)); 
    end;
   end;

my question is in this simple case why my tx and z do not contain the same values eventhough i did not introduce any noise yet? thanks!

values of tx comes as follows:

Columns 1 through 13

 0     1     1     0     0     0     0     0     0     1     1     1     0

Columns 14 through 26

 1     1     1     1     0     1     1     1     0     0     0     1     1

Columns 27 through 32

 0     0     1     0     0     1

values of the z comes as follows:

Columns 1 through 13

 3     0     1     1     0     0     0     0     0     0     1     1     1

Columns 14 through 26

 0     1     1     1     1     0     1     1     1     0     0     0     1

Columns 27 through 32

 1     0     0     1     0     0


  h =

         Type: 'OQPSK Modulator'
            M: 4
  PhaseOffset: 0
Constellation: [1x4 double]
  SymbolOrder: 'Binary'
SymbolMapping: [0 1 2 3]
    InputType: 'Integer'

  g =

         Type: 'OQPSK Demodulator'
            M: 4
  PhaseOffset: 0
Constellation: [1x4 double]
  SymbolOrder: 'Binary'
SymbolMapping: [0 1 2 3]
   OutputType: 'Integer'
 DecisionType: 'Hard decision'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

偏闹i 2024-08-29 11:26:07

我很难说,因为我没有安装通信工具箱,但我建议使用文档中示例中给出的更简单的输入来尝试。 使用

tx = randint(10,1,8) 

例如 。然后查看输出而不仅仅是比较。差异是否等于或接近机器精度?您不会告诉我们打印出什么(它们是否匹配?)。尝试计算 tx 和 z 之间的差异。它接近 eps (对我来说是 2.2204e-016)吗?

输入的数据和输出的数据之间是否存在转换?告诉我们数据发生了什么。

更新

我很高兴您发布了实际的输入和输出。看起来 z 向右移动了一位(并且由于某种原因在开头有一个 3),这意味着你丢失了最后一位。查看 Matlab 文档,有一个注释说

OQPSK 解调器有一个符号 1
延迟。

我认为这可以解释问题。基本上,只需在调制器的输入末尾填充一个额外的 0,从解调器的输出中取出第一个元素,然后就可以开始工作了。

It's hard for me to tell since I don't have the communications toolbox installed, but I would suggest trying this with a simpler input as given in the examples in the documentation. Use

tx = randint(10,1,8) 

for instance. Then look at the output rather than just comparing. Are the differences at or near machine precision? You don't tell us what is printed out (are they matching or not?). Try taking the difference between tx and z. Is it near eps (2.2204e-016 for me)?

Is there a shifting between the data going in and the data coming out? Tell us what is going on with the data.

Update

I'm glad that you posted that actual input and output. It looks like z is shifted one to the right (and has a 3 at the beginning for some reason) which means you lose the last bit. Looking at the Matlab documentation, there is a note that says

OQPSK demodulators have a 1 symbol
delay.

I think that explains the problem. Basically, just pad an extra 0 at the end of the input to the modulator, take off the first element from the output of the demodulator, and you're in business.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文