📄 cp0803_rakeselector.m
字号:
%
% FUNCTION 8.11 : "cp0803_rakeselector"
%
% Simulates channel estimation for a discrete time channel impulse response
% 'hf' with time resolution 'ts' in seconds
% In addition,the function evaluates the weighting factors to be used in a
% RAKE receiver implementing maximal ratio combing
% 'fc' is the value of the sampling frequency
% 'L' is the number of coefficients to be used in the PRake
% 'S' is the number of coefficients to be used in the SRake
%
% The function returns:
% 1) a vector 'G' containing all the amplitude coefficients of the channel
% impulse response in descending order
% 2) a vector 'T' containing all the relative delays for the elements in
% vector 'G',i.e.,T(j) represents the relative delay of the multi-path
% component having amplitude G(j)
% 3) the number 'NF' of non-zero contribution of the channel impulse
% response
% 4) a vector 'Arake' representing the weighting factors to be used in a
% ideal RAKE,which processes all the multi-path contributions at the
% receiver input
% 5) a vector 'Srake' representing the weighting factors to be used in a
% SRAKE,which processes the best L multi-path contributions at the
% receiver input
% 6) a vector 'Srake' representing the weighting factors to be used in a
% SRAKE,which processes the best S multi-path contributions at the
% receiver input
% 7) a vector 'Prake' representing the weighting factors to be used in a
% PRAKE,which processes the first L multi-path contributions that arrive
% at the receiver input
%
function [G,T,NF,Arake,Srake,Prake]=cp0803_rakeselector(hf,fc,ts,L,S)
%====================================================================
% Step One - Channel estimation
%====================================================================
dt=1/fc;
ahf=abs(hf);
[s_val,s_ind]=sort(ahf);
NF=0;
i=length(s_ind);
j=0;
%evaluation of the reference vectors for the RAKE combiner
while (s_val(i)>0)&(i>0)
NF=NF+1;
j=j+1;
index=s_ind(i);
I(j)=index;
T(j)=(index-1)*dt;
G(j)=hf(index);
i=i-1;
end
%===================================================================
% Step Two - Evaluation of the weighting terms
%===================================================================
binsamples=floor(ts/dt);
if S>NF
S=NF;
end
if L>NF
L=NF;
end
Arake=zeros(1,NF*binsamples);
Srake=zeros(1,NF*binsamples);
Prake=zeros(1,NF*binsamples);
% SRAKE and all RAKE
for nf=1:NF
x=I(nf);
y=G(nf);
Arake(x)=y;
if nf<=S
Srake(x)=y;
end
end % for nf=1:NF
% PRAKE
[tv,ti]=sort(T);
TV=tv(1:L);
TI=ti(1:L);
tc=0;
for n1=1:length(TV)
index=TI(n1);
x=I(index);
y=G(index);
Prake(x)=y;
tc=tc+1;
L=L-1;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -