Question
The MATLAB file below simulates the BER with the simple linear combining method in BPSK. Modify the file to extend the modulation method from BPSK
The MATLAB file below simulates the BER with the simple linear combining method in BPSK. Modify the file to extend the modulation method from BPSK to QPSK. One of the changes that you have to do is the creation of the complex symbols according to the modulation method. For example in case of BPSK, s=sign(rand-0.5) and in case of QPSK s=sign(rand-0.5)+j*sign(rand-0.5). Remember, there are more changes to do!
clear EbN0dB_vector=[0 3 6 9 12 15]; % Set EbN0 values in dB. Eb=2; %Total bit energy for two time slots T1 and T2. Refer to Table 28.3.
for snri=1:length(EbN0dB_vector) EbN0dB=EbN0dB_vector(snri); EbN0=10^(EbN0dB/10); N0=Eb/EbN0; errcnt=0; symcnt=0; while errcnt<500 %Decrease errcnt if the simulation takes long time but the result will be less accurate. s1=sign(rand-0.5); s2=sign(rand-0.5); %%%Generating fading coefficient and noise %%%%%%%%%%%%% hA=sqrt(1/2)*(randn+j*randn); hB=sqrt(1/2)*(randn+j*randn); n1=sqrt(N0/2)*(randn+j*randn); %Received noise at T1. n2=sqrt(N0/2)*(randn+j*randn); %Received noise at T2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%Generating Alamouti coded received signal%%%%%%%%%%% r1=hA*s1+hB*s2+n1; %received signal at T1. r2=hA*conj(s2)-hB*conj(s1)+n2; %received signal at T2. Refer to Table 28.3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%Simple linear combining for decoding!!!!%%%%%%%% z1= conj(hA)*r1-hB*conj(r2); % Decision variable for s1 z2= conj(hB)*r1+hA*conj(r2); % Decision variable for s2 s1_hat=sign(real(z1)); s2_hat=sign(real(z2)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if(s1_hat~=s1) errcnt=errcnt+1; end if(s2_hat~=s2) errcnt=errcnt+1; end symcnt=symcnt + 2; end BER(snri)=errcnt/symcnt; save alamouti_BER.mat EbN0dB_vector BER end figure semilogy( EbN0dB_vector, BER); title('Alamouti coded, BPSK, Rayleigh fading'); xlabel('Eb/N0 [dB');ylabel('BER'); grid on
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started