Re: [問題] 可以幫我看看BPSK嗎?(over Rayleigh Ch …已回收

看板MATLAB作者 (專心讀書不忘休閒)時間14年前 (2009/11/28 21:02), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
請問一下 如果我要將這個信號在Rayleigh Channel下模擬 我是將原程式加了以下的rayleigh fading程式碼進去 ch1=rayleighchan(1/1000,100); faded_s=filter(ch1,data_s); 可是跑出來的值跟理論值相差很多 可以請幫我看一下嗎 ※ 引述《ck901004 (ck901004)》之銘言: : 您好,我稍微看了一下。 : 不太愛用 function,改成整份code, : SNR_dB1=0:2:20; : SNR_dB2=0:0.1:20; : bit_err_prb=zeros(1,length(SNR_dB1)); : theo_err_prb=zeros(1,length(SNR_dB2)); : for i=1:length(SNR_dB1), : N=50000; : E=1; % energy per symbol : snr=10^(SNR_dB1(i)/10); : vari=sqrt(E/snr/2); % 修正一 : % generate of the random data sourses between 0 & 1 data_s=sign(randint(1,N)-0.5); : % dection and the probability of error calculation : numofbiterror=0; ch1=rayleighchan(1/10000,100); faded_s=filter(ch1,data_s); : for j=1:N, n=vari*(randn(1,N) + 1i*randn(1,N)); r=faded_s+n; : % correlation metrics : c00=dot(r,1); % 1 : c01=dot(r,-1); % 0 : c_max=max([c00,c01]); : if (c00==c_max), : decis=1; : elseif (c01==c_max), : decis=-1; : end : % increment the error counter, if the decision is not correct : if(decis~=data_s(j)), : numofbiterror=numofbiterror+1; : end : end : pb=numofbiterror/N; : bit_err_prb(i)=pb; : end : for i=1:length(SNR_dB2), : SNR=exp(SNR_dB2(i)*log(10)/10); theo_err_prb(i)=0.5*(1-sqrt(SNR/(SNR+1))); : end : semilogy(SNR_dB2,theo_err_prb,SNR_dB1,bit_err_prb,'r*'); : 其實問題出在你的 noise ,其他並無重大錯誤。 : 希望有幫助~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 222.228.171.110 ※ 編輯: ronnie1138 來自: 222.228.171.110 (11/30 23:43)
文章代碼(AID): #1B4HzxKU (MATLAB)
文章代碼(AID): #1B4HzxKU (MATLAB)