⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transmitterreceiver.asv

📁 APSK仿真程序
💻 ASV
字号:
%This is the main project file.
%Transmitter and Receiver both are implemented here.
%The results of the simulations are also shown at the end.

%clear all;
%clc;
Parameter;
%InputBits = double(rand(1, TotalBitsCount) > 0.5);
load DataGeneration InputBits;

%Computing Root-Raised Cosine Filter Coefficients
RRC_Filter_Coeff = rcosfir(RollOff_Factor, N_T, RATE, Ts, 'sqrt');

%Highest freq contents in the signal = SamplingRate / 2
FractionOfHihestFreq = BaseBand_BandWidth / (SamplingRate / 2);

%Since performing two times RRC filter at the transmit and receive.
%so delay should be twice of the RRC half length length
InitialDelayReceivedSignal = 2 * floor(length(RRC_Filter_Coeff)/2);
InputBits = [InputBits, zeros(1, BitPerFrame)];
%Initializing the initial condition for RRC filters
Zi_Length = length(RRC_Filter_Coeff) - 1;
Zi_T_RRC_I = zeros(1, Zi_Length);
Zi_T_RRC_Q = zeros(1, Zi_Length);
Zi_R_RRC_I = zeros(1, Zi_Length);
Zi_R_RRC_Q = zeros(1, Zi_Length);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Main Loop related variables initialization
NextCarrierPhase = 0;
IndexFrame = 1;
InputSymbols=[];
OutputSymbols=[];
OutputBits = [];

%******* START: Main Transmit-Receive Loop ************************
while (IndexFrame-1)*BitPerFrame+BitPerFrame <= length(InputBits)
%Transmitter Part
    %Bits Frame    
    Bits = InputBits((IndexFrame-1)*BitPerFrame+1:(IndexFrame-1)*BitPerFrame+BitPerFrame);
    %Bits combination to symbol mapping
    Symbols = Bits2Symbols(Bits);
    InputSymbols=[InputSymbols,Symbols];
    %Symbols to Base band Signal generation
    [Sig_Inphase, Sig_Quad, Zf_T_RRC_I, Zf_T_RRC_Q] = Symbols2BaseBand(Symbols, RRC_Filter_Coeff, Zi_T_RRC_I, Zi_T_RRC_Q);

    %Modulation (InPhase)
    RealModSig = SigModulation(Sig_Inphase, TRUE, NextCarrierPhase);
    %Modulation (Quadrature)    
    QuadModSig = SigModulation(Sig_Quad, FALSE, NextCarrierPhase);
    %Signal to Transmit
    SigToTransmit = RealModSig - QuadModSig;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Channel Part
  SigReceived = Channel(SigToTransmit);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Receiver Part
    %DeModulation (InPhase)
    Sig_Inphase_DeModulated = SigDeModulation(SigReceived, TRUE, NextCarrierPhase);
    %DeModulation (Quadrature)
    Sig_Quad_DeModulated = SigDeModulation(SigReceived, FALSE, NextCarrierPhase);
    
    %BaseBand signal to Symbols generation
    [SymbolsRecovered, Zf_R_RRC_I, Zf_R_RRC_Q] = BaseBand2Symbols1(Sig_Inphase_DeModulated, Sig_Quad_DeModulated, RRC_Filter_Coeff, Zi_R_RRC_I, Zi_R_RRC_Q, InitialDelayReceivedSignal);
    
    InitialDelayReceivedSignal = 0;
    %Symbols to Bits mapping
    BitsRecovered = Symbols2Bits(SymbolsRecovered);
    %Insert Output Bits
    OutputSymbols=[OutputSymbols,SymbolsRecovered];
    OutputBits = [OutputBits, BitsRecovered];
    
    %Assigning the final conditions to the initial conditions for all the
    %filters.
    Zi_T_RRC_I = Zf_T_RRC_I;
    Zi_T_RRC_Q = Zf_T_RRC_Q;
    Zi_R_RRC_I = Zf_R_RRC_I;
    Zi_R_RRC_Q = Zf_R_RRC_Q;
   
    %Computing the next phase for the carrier signal
    NextCarrierPhase = NextCarrierPhase + SymbolsPerFrame * Ts;
    %Incrementing the Bits Frame Index
    IndexFrame = IndexFrame + 1;
end
%******* END: Main Transmit-Receive Loop ************************

%Results Found..........
%Computing the number of errors
SymbolsErrorsFound = length(find( (InputSymbols(1:length(OutputSymbols)) == OutputSymbols) == 0 ));
BitErrorsFound = length(find( (InputBits(1:length(OutputBits)) == OutputBits) == 0 ));
disp('******************************************');
disp('APSK Results Found....................');
disp('Number of Bits Transmitted:');
disp(TotalBitsCount);
disp('Number of Bits Received Correctly:');
disp(TotalBitsCount-BitErrorsFound);
disp('Number of Bits Received with Error:');
disp(BitErrorsFound);
%Computing the Bit error Probability
Pb = (BitErrorsFound/TotalBitsCount);
disp('Bit Error Probability (Pb):');
disp(Pb);
disp('******************************************');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -