System bit error rate matlab simulation based on AF power optimization

Table of contents

1. Theoretical basis

2. Core program

3. Simulation conclusion


1. Theoretical basis


       Communication system is an indispensable part of modern society, it can realize the transmission and exchange of information. In a communication system, the bit error rate is a very important performance index, which reflects the probability of error when the system transmits information. Therefore, when designing and optimizing a communication system, it is necessary to simulate and analyze the bit error rate in order to evaluate the performance of the system.

      This paper will introduce a communication system bit error rate simulation method based on AF power optimization and QPSK modulation and demodulation. The article is divided into four parts. First, the basic concepts of BER and AF power optimization in communication systems are introduced. Then, the principle and process of QPSK modulation and demodulation are introduced in detail. Then, the method and steps of bit error rate simulation are expounded, and the simulation results and analysis are given. Finally, summarize and look forward to the article.

2. Bit error rate and AF power optimization

       The bit error rate is an important performance index in the communication system, which reflects the probability of errors during information transmission. The bit error rate is usually expressed by the bit error rate (BER), which is the ratio of the number of errored bits transmitted per unit time to the total number of bits. The lower the bit error rate, the better the performance of the communication system.

       AF power optimization is a communication system optimization method, which can save power as much as possible on the premise of ensuring the transmission quality of the system. The basic principle of AF power optimization is to select an appropriate power allocation mode on each node so that the transmission quality of the entire system reaches the best state and the power consumption is minimized.

3. QPSK modulation and demodulation

       QPSK modulation is a commonly used digital modulation technology, which can convert digital signals into analog signals for transmission in communication channels. The principle of QPSK modulation is to combine every two bits into a symbol, and then map the symbol to a specific carrier phase to form a corresponding modulated signal. Specifically, QPSK modulation maps four phase states ($0^\circ$, $90^\circ$, $180^\circ$ and $270^\circ$) to four symbols (00, 01, 10 and 11 ), as shown in Figure 1.
       QPSK demodulation is the process of converting the received modulated signal back into a digital signal. The principle of QPSK demodulation is to divide the received signal into two paths, multiply them with two orthogonal carriers, and then integrate the results to obtain two sample values. By comparing the magnitudes of these two sample values, it is possible to determine which symbol was received. Specifically, if both sample values ​​are positive, the received symbol is 00; if the first sample value is positive and the second sample value is negative, then the received symbol is 01; if both samples The values ​​are both negative, then the received symbol is 10; if the first sample value is negative and the second sample value is positive, then the received symbol is 11.

4. Bit error rate simulation

        Bit error rate simulation is a communication system performance analysis method, which can be used to evaluate communication system performance indicators such as transmission quality and bit error rate. BER simulation consists of two main steps: channel modeling and BER calculation.

       Channel modeling is the first step in simulation and is used to simulate effects such as interference and fading in communication channels. Commonly used channel models include AWGN channel model, Rayleigh channel model and Gaussian channel model. In this article, we will use the AWGN channel model for simulation.

      The bit error rate calculation is the second step of the simulation, which is used to calculate the ratio of the number of bits with errors to the total number of bits during transmission. The accuracy of BER calculation depends on the number of simulations and the amount of data for each simulation. Typically, multiple simulations are performed and averaged to obtain more accurate results.

In this article, we will use MATLAB software for bit error rate simulation. Specific steps are as follows:

      Generate a random bit sequence. First, a set of random bit sequences need to be generated as input to the sender. You can use the rand function or randi function in MATLAB to generate random numbers and then convert them into binary bit sequences.

       Perform QPSK modulation. QPSK modulation is performed on the generated bit sequence to obtain a modulated signal.

       Add white Gaussian noise. To simulate noise interference in a communication channel, use the awgn function in MATLAB to add white Gaussian noise to the modulated signal.

       Perform QPSK demodulation. The received signal is subjected to QPSK demodulation to obtain a demodulated bit sequence.

       Calculate the bit error rate. Compare the bit sequence at the sending end with the bit sequence at the receiving end, count the number of erroneous bits and the total number of bits, and then calculate the bit error rate.

       Repeat the above steps to perform multiple simulations. As needed, multiple simulations can be performed and averaged to obtain more accurate results.

2. Core program

clc;
clear;
close all;
warning off;
addpath(genpath(pwd));
 

fprintf( 'AF仿真\n') ;
%产生随机序列
N=120000;
maxsnr=40;
BerSnrTable1 = zeros(maxsnr+1,3);

for SNR=0:maxsnr
    SNR
    BerSnrTable1(SNR+1,1) = SNR;
    BitTx=floor(rand(1,N)*2);
    %星座图映射,QPSK
    SymQpsk=QpskMapping(BitTx);
    SymQpskd=[];
    M=length(SymQpsk);
    %噪声能量(已归一化)
    zsnl=sqrt(1/(10^((SNR)/10)));
    %==========================================
    for i=1:M
        %生成服从瑞利分布的信道系数
       H0=(randn+j*randn)/sqrt(2);
       H1=(randn+j*randn)/sqrt(2);
       H2=(randn+j*randn)/sqrt(2);
       
       %生成加性高斯白噪声
        N0=zsnl*(randn+j*randn);
        N2=zsnl*(randn+j*randn);
        N1=zsnl*(randn+j*randn);
        a=abs(H1);
        G=sqrt(2/(4*a*a+3*zsnl*zsnl));%E0=4/3,E1=2/3,根据<无线合作分集网络中的资源分配研究>
        %接收信号
        R1=H0*sqrt(4/3)*SymQpsk(i)+N0;
        R2=H2*G*(H1*sqrt(4/3)*SymQpsk(i)+N1)+N2;
        %信号合成
        S1=conj(H0)*sqrt(4/3)*R1/(zsnl*zsnl);
        S2=conj(H2)*conj(H1)*sqrt(4/3)*G*R2/(zsnl*zsnl);
        SS=S1+S2;
        %解调
        dh = [1+j -1+j -1-j 1-j]/sqrt(2);
        D1=abs(SS*[1 1 1 1]-dh).^2;
        [minScale1 positionmin1]=min(D1);
        SymQpskd=[SymQpskd dh(positionmin1)];
    end
    BitRx=QpskInverseMapping(SymQpskd);
    [Num,Ber]=symerr(BitTx,BitRx);
    BerSnrTable1(SNR+1,2) = Num ;
    BerSnrTable1(SNR+1,3) = Ber ;
end

figure(1);
semilogy(BerSnrTable1(1:4:maxsnr+1,1),BerSnrTable1(1:4:maxsnr+1,3),'b-o');
up2117

3. Simulation conclusion

Guess you like

Origin blog.csdn.net/ccsss22/article/details/131058695