在GSM系统中,手机开机之后、首先进行多项测量,测量的目的在于实现小区初搜过程。在这里我们给出小区初搜对于FCCH的确定方法的MATLAB程序,程序的主要功能在于确定FCCH的峰值、从而确定FCCH的起始位置。
function FB_detector_phasedifference(r,OSR,FN0,TN0,Lburst,firstAddress)
% FB_detector:
% This function is intended to find the FB and the FB end time!
%
%
% SYNTAX: FB_detector_phasedifference(r,OSR,FN0,TN0,Lburst,firstAddress)
%
% INPUT: r: The received signal.
% OSR: The over sampling ratio, defined as f_s/r_b. This
% parameter is not used in the incuded channel_simulator
% function, but is passed to the function for future
% use.
% FN0: multiframe Number
% TN0: timeslot number
% Lburst: length of a burst
% firstAddress: position of FCCH
% 4 decimate 1
r = r(1:OSR:FN0*TN0*(Lburst+2)*OSR);
% initialize variables
c = zeros(1,FN0*TN0*(Lburst+2));
x = zeros(1,FN0*TN0*(Lburst+2));
y = zeros(1,FN0*TN0*(Lburst+2));
p = zeros(1,FN0*TN0*(Lburst+2));
e = zeros(1,FN0*TN0*(Lburst+2));
ratio = zeros(1,FN0*TN0*(Lburst+2));
s = zeros(1,FN0*TN0*(Lburst+2));
% parameters
K=4;
B=0.88;
D=0.95;
E=0.96;
H=0.25;
P=70;
t1=100;
t2=400;
for n=5:FN0*TN0*(Lburst+2)
c(n)=r(n)*conj(r(n-K) ); % phase difference
x(n)=B*x(n-1)+(1-B)*c(n) ; % LPF
y(n)=x(n)-x(n-1)+D*y(n-1); %notch filter
p(n+1)=E*p(n)+(1-E)*abs(x(n))*abs(x(n)); % power of before notch filter
e(n+1)=E*e(n)+(1-E)*abs(y(n))*abs(y(n)); % power of after notch filter
if p(n+1) ~= 0
ratio(n+1) = e(n+1)/p(n+1); % ratio
end
if ratio(n+1) < H
s(n+1)=0;
else
s(n+1) = 1;
end
end
plot(ratio(1:300));
figure;
plot(ratio(12000:12500));
s=s(1:1480)
s_sub = state_mach(s);
% plot(s);