Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Why is the last simulation value is "0",i can't find where is wrong
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
I write an error probability of anti-podal,however,i found the  last simulation value is zero,it means that there is no any error signal in the receiver at that time,but that is possible,and i can't find where do i wrong,can anyone help me?
Code
T_s=10^4;
SNR_dB=[-3 0 3 6 9];
SNR_Watt=10.^(SNR_dB./10);
anti_signal=rand(1,T_s)
%Create the anti-podal signal
for ii=1:length(SNR_dB)
    for t=1:T_s   
        if anti_signal(t)>0.5
            anti_signal(t)=1;
        else
            anti_signal(t)=-1;
        end
    end
    %AWGN noise
    noise=(1/sqrt(2)*[randn(1,T_s)+1i*randn(1,T_s)]);
    %receive_signal
    %10.^(-SNR_dB(ii)/20)*noise is the noise in "x" SNR,like  -3dB,0dB,3dB,6dB and 9dB
    receive_signal=anti_signal+10.^(-SNR_dB(ii)/20)*noise;
    for q=1:T_s
        if receive_signal(q)>0
            receive_signal(q)=1;
        else
            receive_signal(q)=-1;
        end
    end
    simulation(ii)=(T_s-sum(anti_signal==receive_signal))/T_s%(Total number-the number which is right)-Total number  
end
theoretical=1/2*erfc(sqrt(SNR_Watt));
semilogy(SNR_dB,simulation,SNR_dB,theoretical)
 The simulation result is as below,as we can see,the last number is always "0",why?i think there is something wrong in the code,but if this 0 is correct,i can't find a reasonable reason to convince to me

답변 (1개)
  Walter Roberson
      
      
 2019년 4월 21일
        Your noise is complex valued, so your received_signal is complex valued. However, your if statements treat it as if it were real valued.
댓글 수: 0
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


