awgn信道c语言程序,关于awgn信道的程序求解~!

求高手讲解一下以下程序的思路或原理,万分感谢!!英文注释理解不了

%This program simulates BER of BFSK in AWGN channel%

clear all; close all; clc;

num_bit=10000;                           %Signal length

max_run=20;                              %Maximum number of iterations for a single SNR

Eb=1;                                    %Bit energy

SNRdB=0:1:10;                            %Signal to Noise Ratio (in dB)

SNR=10.^(SNRdB/10);

hand=waitbar(0,'Please Wait....');

for count=1:length(SNR)                  %Beginning of loop for different SNR

avgError=0;

No=Eb/SNR(count);                    %Calculate noise power from SNR

for run_time=1:max_run               %Beginning of loop for different runs

waitbar((((count-1)*max_run)+run_time-1)/(length(SNRdB)*max_run));

Error=0;

data=randint(1,num_bit);         %Generate binary data source

s=data+j*(~data);                %Baseband BFSK modulation

NI=sqrt(No/2)*randn(1,num_bit);

NQ=sqrt(No/2)*randn(1,num_bit);

N=NI+j*NQ;                       %Generate complex AWGN

Y=s+N;                           %Received Signal

for k=1:num_bit                  %Decision device taking hard decision and deciding error

Z(k)=real(Y(k))-imag(Y(k));

if ((Z(k)>0 && data(k)==0)||(Z(k)<0 && data(k)==1))

Error=Error+1;

end

end

Error=Error/num_bit;             %Calculate error/bit

avgError=avgError+Error;         %Calculate error/bit for different runs

end                                  %Termination of loop for different runs

BER_sim(count)=avgError/max_run;     %Calculate BER for a particular SNR

end                                      %Termination of loop for different SNR

BER_th=(1/2)*erfc(sqrt(SNR/2));          %Calculate analytical BER

close(hand);

semilogy(SNRdB,BER_th,'k');              %Plot BER

hold on

semilogy(SNRdB,BER_sim,'k*');

legend('Theoretical','Simulation',3);

axis([min(SNRdB) max(SNRdB) 10^(-5) 1]);

hold off

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值