您当前的位置: 首页 >  matlab

phymat.nico

暂无认证

  • 2浏览

    0关注

    1967博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

matlab实现的Li-Fi模拟

phymat.nico 发布时间:2021-05-05 15:59:42 ,浏览量:2

for sim_index = 1:Len
    Psn = snrVec(sim_index);
    snr = 10^(Psn/10);
   
    A_PPM = sqrt(snr*2);
    
    for loops = 1:IterNum
        Source = randi([0,1],1,BitNum);
        codec_out = convenc(Source,Trellis);
        % OOK modulation
        Sym_OOK = codec_out;
                
        % waveform shaping
        Tx_OOK = WaveForm(Sym_OOK,SamplePerSym*SymbolNum*2);

        % get the oversample factor
        n_PPM = length(Tx_OOK)/length(Sym_OOK);

        % additive noise channel 这里添加一些干扰控制
        noise = randn(1,length(Tx_OOK));
        Rec_OOK = A_PPM*Tx_OOK + noise(1:length(Tx_OOK));

        % decision
        Dec_OOK = Hard_Decision(Rec_OOK,n_PPM,Threshold);

        % decode
        Sink_OOK = VLC_Decode('OOK',Dec_OOK,1);
        
        % decoder
        DecoderOut = vitdec(Sink_OOK,Trellis,TraceLen,'trunc','hard');
        
        % ber for PPM
        [~,ber] = biterr(DecoderOut,Source);
        BER(1,sim_index) = BER(1,sim_index) + ber;
        
        % PER
        if(ber)
            PER(1,sim_index) = PER(1,sim_index) + 1;
        end

    end % loop for iteration
    
end % loop for Psn

 

关注
打赏
1659628745
查看更多评论
立即登录/注册

微信扫码登录

0.0431s