【问题标题】:AWGN simulation with binary asymmetric channel in Matlab在 Matlab 中使用二进制非对称通道进行 AWGN 仿真
【发布时间】:2013-03-25 23:13:05
【问题描述】:

我环顾四周,但找不到在 matlab 中模拟二进制不对称通道的解决方案。我应该模拟一个 BSC(二进制对称通道)以及一个不对称通道,误差概率为 0.001。

我设法进行二进制对称模拟(对于任何想要使用它的人)

r = rand(1000000,1);    % uniform data set generation
x = zeros(1000000,1);   % data to be sent initialised 

for i = 1:1000000       % mapped to BPSK signal (-1,1)
if r(i,1) >= 0.5
    x(i,1) = 1;
else
    x(i,1) = -1;
end
end

SNR = qfuncinv(0.001);
SNRdB = 10*log(SNR);
y = awgn(x,SNRdB);    
y = awgn(x,9.79982258);    %noise added to inputs through Signal to noise 
               %ratio


for i = 1:1000000
if(abs(y(i,1) - 1) < abs(y(i,1) + 1) )    %between -1 and 1
    y(i,1) = 1;                         %map back through 
else            %minimum distance estimations
    y(i,1) = -1;
end

if(x(i,1) == y(i,1))    % determine if estimation errors are made
    r(i,1) = 0; 
else
    r(i,1) = 1;
end
end

errors = sum(r);
sprintf('%0.8f',errors/1000000)     %show error percentage

好吧,我仍然需要进行非对称通道模拟,但找不到使用 matlab 完成此操作的线索。

将感谢任何解决此问题的实现的链接

【问题讨论】:

    标签: matlab


    【解决方案1】:

    如果我错了,请纠正我,但非对称二进制通道是一个二进制通道,它的概率误差从 0 到 1 与从 1 到 0 不同。所以,你的代码应该如下所示:

    function channel_simulation(BER1,BER2,Nbits)
    
        % BER1: prob 0->1
        % BER2: prob 1->0
    
        if nargin <3, Nbits = 10^6; end
    
        % Data generation mapped to BPSK signal (-1,1)
        r = rand(Nbits,1);   
        x = 2*(r>=0.5)-1;
    
        % Noise (channel 1)
        SNRdB1 = 10*log(qfuncinv(BER1));
        y1 = awgn(x,SNRdB1);    
        y1 = 2*(abs(y1-1)<abs(y1+1))-1;
        r1=(x~=y1);
    
        % Noise (channel 2)
        SNRdB2 = 10*log(qfuncinv(BER2));
        y2 = awgn(x,SNRdB2);    
        y2 = 2*(abs(y2-1)<abs(y2+1))-1;
        r2=(x~=y2);
    
        % Error percentage
        errors = sum(r1.*(x<0)+r2.*(x>0));
        fprintf('Prob: %0.8f\n',errors/Nbits)    
    
    end
    

    你可以尝试调用它:

    channel_simulation(0.001,0.01)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-29
      • 1970-01-01
      • 2012-07-19
      相关资源
      最近更新 更多