how to code selective combining for releight fading

4 ビュー (過去 30 日間)
Maaz Salman
Maaz Salman 2017 年 11 月 17 日
コメント済み: Maaz Salman 2017 年 11 月 17 日
h(k)=sqrt(1/2)*(randn+j*randn); n(k)=sqrt(N0/2)*(randn+j*randn); r(k)=h(k)*s+n(k); end [T1 T2]=max(r(k)); D=r(T1)*exp(-j*angle(T1)); b_hat=sign(real(D)); if b_hat~=b; err_cnt=err_cnt+1; end sym_cnt=sym_cnt+1; I am using this code but it is giving an error in a bold portion....Can u please solve my problem?

回答 (1 件)

Maaz Salman
Maaz Salman 2017 年 11 月 17 日
clear EbN0dB_vector=0:3:15; Eb=1; L=3; for snr_i=1:length(EbN0dB_vector) EbN0dB=EbN0dB_vector(snr_i); EbN0=10.^(EbN0dB/10); N0=Eb/EbN0; sym_cnt=0; err_cnt=0; while err_cnt<100 % If you increase err_cnt (currently 100), the accuracy increases and time also increase. b=sign(rand-0.5); %BPSK symbol{1,-1} s=sqrt(Eb/L)*b; for k=1:L h(k)=sqrt(1/2)*(randn+j*randn); n(k)=sqrt(N0/2)*(randn+j*randn); r(k)=h(k)*s+n(k); end [T1 T2]=max(r(k));% Refer to (25.9). To see how to use max( ), execute ‘>>help max’ in the command window. D=r(T1)*exp(-j*angle(T1));%Refer to (25.9). b_hat=sign(real(D)); if b_hat~=b; err_cnt=err_cnt+1; end sym_cnt=sym_cnt+1; end BER(snr_i)=err_cnt/sym_cnt; end figure semilogy(EbN0dB_vector, BER) xlabel('E_b/N_0 [dB]') ylabel('BER') grid Whole code is given above
  1 件のコメント
Maaz Salman
Maaz Salman 2017 年 11 月 17 日
Error is showing in the portion: [T1 T2]=max(r(k));d window. D=r(T1)*exp(-j*angle(T1)); Can you please solve this problem?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeBPSK についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by