?? theperfectrake.m
字號:
function [y,z]=ThePerfectRake(insig,delays,sigLength,PShape,ChipSamples,chan_code,N,DPCCH_code,N_pilot,scramble_code)
%*******************************************************************************
%function [y,z]=ThePerfectRake(insig,delays,sigLength)
%
%Copyright 2002 The Mobile and Portable Radio Research Group
%
%This function emulates the operation of a "Perfect" rake receiver. This
%receiver is "Perfect" in the sense that has perfect knowledge of the
%multipath delays (but not necessarily the amplitudes.
%
%This receier tunes one tap to each delay and extracts the signal energy at
%that delay. Soft decisions are made at each delay component and then combind in
%and equal gain fashion. Then a hard decision is made. The pilot symbols are
%used to estimate the phase rotation due to the channel. These esitmates are
%updated every slot.
%
%Parameters
% Input
% insig Vector Incoming Signal
% delays Vector Contains the discrete time delays of the multipath
% components
% sigLength Scalar Contains the length of the transmitted signal
% PShape Vector Reciever Filter Impuse response
% ChipSamples Scalar Number of Samples per Chip
% Output
% y Vector Contains the extracted data symbols
% or Matrix
% z Vector Contains the extracted control symbols
%
%*******************************************************************************
NumDelays=length(delays);
ChipsPerSlot=2560;
SF_Control=256;
SF_Data=length(chan_code(1,:));
ControlBitsPerSlot=ChipsPerSlot/SF_Control;
DataBitsPerSlot=ChipsPerSlot/SF_Data;
for k=1:NumDelays
%Receiver Matched Filter
tap_sig=insig(1+delays(k):sigLength+delays(k));
received_signal=WCDMAReceiveFilter(tap_sig.',PShape,ChipSamples);
%Descramble the signal
unscrambled_signal = received_signal.*conj(double(scramble_code));
%Despread the signal
[Rcvd_Control_Sig,Rcvd_Data_Sig]=WCDMADespread(unscrambled_signal,chan_code,N);
%Estimate Phase Offset
PhaseOffset = EstPhaseOffset(Rcvd_Control_Sig,DPCCH_code,N_pilot);
%Note that PhaseOffset will be a vector of length 15, one estimate per slot
%Apply Phase Offset to Received Control Signal and Received Data Signal
for m=1:15
Controlindex=(ControlBitsPerSlot*(m-1)+1):ControlBitsPerSlot*m;
Dataindex=(DataBitsPerSlot*(m-1)+1):DataBitsPerSlot*m;
RotatedRcvdControlSig(k,Controlindex)=PhaseOffset(m)*Rcvd_Control_Sig(Controlindex);
RotatedRcvdDataSig(:,Dataindex,k)=PhaseOffset(m)*Rcvd_Data_Sig(:,Dataindex);
end
end
%Implement Equal Gain Combiner
CombinedControlSig=sum(RotatedRcvdControlSig,1);
CombinedDataSig=sum(RotatedRcvdDataSig,3);
% perform hard decisoins
RcvdCntlBits=sign(real(CombinedControlSig));
switch N
case 1
RcvdDataBits=sign(real(CombinedDataSig));
case 2
RcvdDataBits(1,:)=sign(real(CombinedDataSig));
RcvdDataBits(2,:)=sign(imag(CombinedDataSig));
case 3
RcvdDataBits(1,:)=sign(real(CombinedDataSig(1,:)));
RcvdDataBits(2,:)=sign(imag(CombinedDataSig(1,:)));
RcvdDataBits(3,:)=sign(real(CombinedDataSig(2,:)));
case 4
RcvdDataBits(1,:)=sign(real(CombinedDataSig(1,:)));
RcvdDataBits(2,:)=sign(imag(CombinedDataSig(1,:)));
RcvdDataBits(3,:)=sign(real(CombinedDataSig(2,:)));
RcvdDataBits(4,:)=sign(imag(CombinedDataSig(2,:)));
case 5
RcvdDataBits(1,:)=sign(real(CombinedDataSig(1,:)));
RcvdDataBits(2,:)=sign(imag(CombinedDataSig(1,:)));
RcvdDataBits(3,:)=sign(real(CombinedDataSig(2,:)));
RcvdDataBits(4,:)=sign(imag(CombinedDataSig(2,:)));
RcvdDataBits(5,:)=sign(real(CombinedDataSig(3,:)));
case 6
RcvdDataBits(1,:)=sign(real(CombinedDataSig(1,:)));
RcvdDataBits(2,:)=sign(imag(CombinedDataSig(1,:)));
RcvdDataBits(3,:)=sign(real(CombinedDataSig(2,:)));
RcvdDataBits(4,:)=sign(imag(CombinedDataSig(2,:)));
RcvdDataBits(5,:)=sign(real(CombinedDataSig(3,:)));
RcvdDataBits(6,:)=sign(imag(CombinedDataSig(3,:)));
otherwise
error('N cannot exceed 6 or be less than 1')
end
y=RcvdDataBits;
z=RcvdCntlBits;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -