Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2010-05-25
帖子: 4
声望力: 0 ![]() |
![]()
用bpsk调制加入高斯白噪声分析误码率,运行有错误,请高手看一下哪错了。
sr=256000.0; ml=1; br=sr.*ml; nd=1000; ebn0=0.001; IPOINT=8; irfn=21; alfs=0.5; [xh]=hrollfcoef(irfn,IPOINT ,sr,alfs,1); [xh2]=hrollfcoef(irfn,IPOINT,sr,alfs,0); for i=1:1:10000 data=rand(1,nd)>0.5; data1=(data.*2)-1; [data2]=oversamp(data1,nd,IPOINT); data3=conv(data2,xh); spow=sum(data3.*data3)/nd; attn=0.5*spow*sr/br*10.^(-ebn0/10); attn=sqrt(attn); inoise=randn(1,length(data3)).*attn; data4=data3+inoise; data5=conv(data4,xh2); sampl=irfn*IPOINT+1; data6=data5(sampl:8:8*nd+sampl-1); demodata=data6>0; noe2=sum(abs(data-demodata)); nod2=length(data); ber=noe2/nod2; shu(1,i)=ber; ebn0=ebn0+0.001; %fprintf('%d\t%e\n',i,shu); end x=0.001:0.001:10; y=shu; n=3; p=polyfit(x,y,n); xi=linspace(0,1,1000); z=polyval(p,xi); plot(x,y,'o',xi,z,'k:',x,y,':r'); %legend('原始数据','3阶曲线') %fprintf('%d\t%d\t%d\t%e\n',ebn0,noe2,nod2,noe2/nod2); %fid=fopen('BERbpskfad.dat','a'); %fprintf(fid,'%d\t%e\t%f\t%f\t\n',ebn0,noe2,nod2,noe2/nod2); %fclose(fid); |
![]() |
![]() |