关于MATLAB源代码:
function [G,T,NF,Arake,Srake,Prake] = ...
cp0803_rakeselector(hf,fc,ts,L,S)
% -----------------------------
% Step One - Channel Estimation
% -----------------------------
dt = 1 / 50e9;
ahf = abs(zeros(1,5));
[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(2e-9/dt);
if 5 > NF
S = NF;
end
if 5 > NF
L = NF;
end
Arake = zeros(1,NF*binsamples);
Srake = zeros(1,NF*binsamples);
Prake = zeros(1,NF*binsamples);
% Selective Rake 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 nl = 1 : length(TV)
index = TI(nl);
x = I(index);
y = G(index);
Prake(x) = y;
tc = tc + 1;
L = L - 1;
end
运行显示:??? Undefined function or variable "T".
Error in ==> cp0803_rakeselector at 101
[tv,ti] = sort(T);
望高手解答,谢谢
追问:这个是超宽带无线电基础这本书上的
答案:估计是这个循环没有执行, 你设一下断点, 看看T到底呗赋值了没有, 如果没有, 就会出现上述情况.
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
其他:你这个是普罗克斯或者译为普罗金斯的现代通信系统使用matlab一书上的吧。这个是多幅度信号仿真。使用的的是蒙特卡罗仿真方法,就是用很多次实验的到的结果仿真
上一个:matlab 7.0 和matlab7.1能相互用吗? matlab7.0里面的模块能在matlab 7.1中运行吗?
下一个:在用matlab处理数据的过程中:输入A=xlsread('1.xlsx')是什么意思?