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

📄 cp0801_ppmreceiver.m

📁 cp0801_PPMcorrmask为PPM-TH-UWB信号的相关模板信号计算函数
💻 M
字号:
% FUNCTION 8.5 :"cp0801_PPMreceiver"
%
% Simulates the receiver for 2PPM TH UWB signals and compute the average
% BER
% 'R' is an array containing different waveforms of the received signals
% 'mask' is the waveform of the correlation mask
% 'fc' is the sampling 
% 'bits' is the binary stream generated by the source
% (it is the same stream for all the waveforms in 'R')
% 'Ns' is the number of pulses per bit
% 'Ts' is the average pulse repetition period [s]
%
% The function returns the binary stream after the detection process
% ('RXbits'),and the vector 'BER' containing the average bit error
% rates for all the signals in the input array 'R'
%
function [RXbits,BER]=cp0801_PPMreceiver(R,mask,fc,bits,numbit,Ns,Ts)
%--------------------------------------------------------------------
% Step One - Receiver setting
%--------------------------------------------------------------------
HDSD=1;
%HDSD=1 ----> hard decision detection
%HDSD=2 ----> soft decision detection

%--------------------------------------------------------------------
% Step Two - Implementation of the receiver
%--------------------------------------------------------------------
% N is the number of different signals at the receiver
% input L is the number of samples representing each signal
[N L]=size(R);
RXbits=zeros(N,numbit);
dt=1/fc;
framesamples=floor(Ts./dt);
bitsamples=framesamples*Ns;

for n=1:N
    rx=R(n,:);
    mx=rx.*mask;
    
    if HDSD==1  % hard decision detection
        for nb=1:numbit
            mxk=mx(1+(nb-1)*bitsamples:bitsamples+(nb-1)*bitsamples);
            No0=0;
            No1=0;
            for np=1:Ns
                mxkp=mxk(1+(np-1)*framesamples:framesamples+(np-1)*framesamples);
                zp=sum(mxkp.*dt);
                if zp>0
                    No0=No0+1;
                else
                    No1=No1+1;
                end
            end  %for np=1:Ns
            if No0>No1
                % the estimated bit is '0'
                RXbits(n,nb)=0;
            else
                % the estimated bit is '1'
                RXbits(n,nb)=1;
            end
        end % for nb=1:numbit
    end % end of hard decision detection
    
    if HDSD==2 % soft decision detection
        for nb=1:numbit
            mxk=mx(1+(nb-1)*bitsamples:bitsamples+(nb-1)*bitsamples);
            zb=sum(mxk.*dt);
            if zb>0
                % the estimated bit is '0'
                RXbits(n,nb)=0;
            else
                % the estimated bit is '1'
                RXbits(n,nb)=1;
            end
        end % for nb=1:numbit
    end % end of the soft decision detection
end %for n=1:N
for n=1:N
    WB=sum(abs(bits-RXbits(n,:)));
    BER(n)=WB/numbit;  %average BER
end

⌨️ 快捷键说明

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