移动通信实验报告(2)

时间:2025-04-20

武汉理工大学,移动通信,信息学院,通信工程

实验课程名称:移动通信系统实验

武汉理工大学,移动通信,信息学院,通信工程

⑩ 统计错误比特: 误差向量 “err” 中的每一个非零元素对应着一个错误的比特。 最后计算误比特率 BER:每运行一次误比特率仿真,就需要传输和接收固定数量 的比特,然后确定接收到的比特中有多少错误的。使用 MATLAB 计算 BER: ber=te/length(tx)。

四.实验内容1.实验程序 a% Simulation of BPSK AWGN Max_SNR=10; N_trials=1000; N=200; Eb=1; ber_m=0; for trial=1:1:N_trials; trial msg=round(rand(1,N)); % 1,0 sequence s=1-msg.*2; %0-->1,1-->1 n=randn(1,N)+j.*randn(1,N); %generate guass white noise ber_v=[]; for snr_dB=1:2:Max_SNR snr=10.^(snr_dB./10); %snr(db)-->snr(decimal) N0=Eb./snr; sgma=sqrt(N0./2); y=sqrt(Eb).*s+sgma.*n; y1=sign(real(y)); y2=(1-y1)./2; %1, 0 sequence error=sum(abs(msg-y2)); %error bits ber_snr=error./N; %ber ber_v=[ber_v,ber_snr]; end %for snr ber_m

=ber_m+ber_v; end ber=ber_m./N_trials; ber_theory=[]; for snr_db=1:2:Max_SNR snr=10.^(snr_db./10); snr_1=qfunc(sqrt(2*snr)); ber_theory=[ber_theory,snr_1]; end i=1:2:Max_SNR; semilogy(i,ber,'-r',i,ber_theory,'*b'); xlabel('E_b/N_0(dB)') ylabel('BER')

武汉理工大学,移动通信,信息学院,通信工程

legend('Monte Carlo','Theoretic')

2. 实验程序 b%Simulation of QPSK AWGN N_trials=1000; N_number=100; N_snr=10; Es=1; BER_m=0; SER_m=0; for trials=1:N_trials; trials s10=round(rand(1,N_number)); S=(s10*2-1)./sqrt(2); S1=S(1:2:N_number); S2=S(2:2:N_number); Sc=S1+j.*S2; %generate qpsk signal noise=randn(1,N_number/2)+j.*randn(1,N_number/2); SER_v=[]; %Symbol error rate BER_v=[]; %Bit error rate for snr_db=0:1:N_snr; sgma=(1/2)*sqrt(10.^(-snr_db./10)); Y=Sc+sgma.*noise; Y_r=sign(real(Y))./sqrt(2); Y_i=sign(imag(Y))./sqrt(2); Y_bit=[]; for k=1:length(Y_r); Y_bit=[Y_bit,[Y_r(k),Y_i(k)]]; end; Y_symbol=Y_r+j*Y_i; X_b=S-Y_bit; X_s=Sc-Y_symbol; ber_snr=0; for k=1:N_number if X_b(k)~=0; ber_snr=ber_snr+1; end; end; ser_snr=0; for k=1:N_number/2; if X_s(k)~=0; ser_snr=ser_snr+1; end; end; BER_v=[BER_v,ber_snr./N_number];

武汉理工大学,移动通信,信息学院,通信工程

SER_v=[SER_v,ser_snr./(N_number./2)]; end; %for SNR BER_m=BER_m+BER_v; SER_m=SER_m+SER_v; end% for trials BER=BER_m./N_trials; SER=SER_m./N_trials; BER_T=[]; SER_T=[]; for snr_db=0:1:N_snr; snr=10.^(snr_db./10); BER_THEORY=qfunc(sqrt(2.*snr)); SER_THEORY=1-(1-(1/2).*erfc(sqrt(snr))).^2; BER_T=[BER_T,BER_THEORY]; SER_T=[SER_T,SER_THEORY]; end; figure i=0:1:N_snr; semilogy(i,BER,'-r',i,BER_T,'*b'); legend('BER-simulation','BER-theory'); xlabel('Eb/NO(db)'); ylabel('BER'); figure i=0:1:N_snr; semilogy(i,SER,'-r',i,SER_T,'*b'); legend('SER-simulation','SER-theory'); xlabel('Eb/NO(db)'); ylabel('SER');

武汉理工大学,移动通信,信息学院,通信工程

五.仿真结果1.实验程序 a

图a 2.实验程序 b

图 b1

武汉理工大学,移动通信,信息学院,通信工程

图 b2

五.实验小结通过本次实验,掌握了二相 BPSK 调制的工作原理及利用 MATLAB 进行误比特 率测试 BER 的方法,学会了 AWGN 信道中 BPSK 调制系统的 BER 仿真计算方法。在 实验过程中我通过不断的调试与学习,对本次实验的内容有了整体的把握,对 MATLAB 的使用也更加熟练,达到了预期的效果,收获很大。

武汉理工大学,移动通信,信息学院,通信工程

实验课程名称:移动通信系统实验

武汉理工大学,移动通信,信息学院,通信工程

theta=0; count=0; t0=0.001; for t=0:Ts:0.5 count=count+1; g(count)=0; for n=1:M+1, if n<=M c_q(count,n)=2*sigma*sin(pi*n/M); c_i(count,n)=2*sigma*cos(pi*n/M); f_i(count,n)=f_max*cos(2*pi*n/N); f_q(count,n)=f_max*cos(2*pi*n/N);

%Gain associated with quadrature component %Gain associated with inphase component %Discrete doppler frequencies of inphase component %Discrete doppler frequencies of quadrature component

else c_i(count,n)=sqrt(2)*cos(pi/4); c_q(count,n)=sqrt(2)*sin(pi/4); f_i(count,n)=f_max; f_q(count,n)=f_max; end; % end if g_i(count,n)= c_i(count,n)*cos(2*pi*f_i(count,n)*(t-t0)+theta); %Inphase component for one oscillator g_q(count,n)= c_q(count,n)*cos(2*pi*f_q(count,n)*(t-t0)+theta); %Quadrature componentforoneoscillator end; %end n tp(count)= sq*sum(g_i(count,1:M+1)); % Total Inphase component tp1(count)= sq*sum(g_q(count,1:M+1)); % Total quadrature component end; % end count no nagain envelope=sqrt(tp.^2+tp1.^2); rmsenv=sqrt(sum(envelope.^2)/count); [auto_i,lag_i]=xcorr(tp,'coeff'); %Auto-correlation associated with inphase component [auto_q,lag_q]=xcorr(tp,'coeff'); %Auto-correlation associated with quadrature component len=length(lag_i); [corrx2,lag2]=xcorr(tp,tp1,'coeff'); aa=-(len-1)/2:1:(len-1)/2; %total duration for lag bb=(len-2001)./2; %mid...points for drawing figures cc=bb+1:1:bb+2001; %for getting the mid-values dd=-1000:1:1000; %----------tdd=dd*Ts;

武汉理工大学,移动通信,信息学院,通信工程

z=2.*pi.*f_max*tdd; sigma0=1; T_bessel=sigma0.^2.*besselj(0,z); figure; plot(tdd,auto_i(cc),'-',tdd,T_bessel,'*'); %in-phase xlabel('t(Second)'); ylabel('Auto-correlation'); legend('In-component'); figure; plot(tdd,auto_q(cc),'-',tdd,T_bessel,'*'); %quadrature xlabel('t(Second)'); ylabel('Auto-correlation'); legend('Q-component'); figure; co1=1:1000; semilogy(co1*Ts,envelope(1:1000)); xlabel('t(Second)'); ylabel('Rayleigh Coef.'); %%-----------length_r=length(envelope); pdf_env=zeros(1,501); count=0; temp=round(100.*envelope); for k=1:length_r if temp(k)<=500 count=count+1; pdf_env(1,temp(k)+1)=pdf_env(1,temp(k)+1)+1; end end count pdf_env=pdf_env./count./0.01; sgma2=0.5; x=[0:0.01:5]; pdf_theory=(x./sgma2).*exp(-1.*x.^2./(2.*sgma2)); figure; p …… 此处隐藏:14904字,全部文档内容请下载后查看。喜欢就下载吧 ……

移动通信实验报告(2).doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219