You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
705 B
Matlab

function [ fs eps p_m w2] = find_pss( x, N_id_2, doplot, threshold)
11 years ago
if nargin == 2
doplot = false;
threshold = 0;
end
if nargin == 3
threshold = 0;
11 years ago
end
c=lte_pss_zc(N_id_2);
cc=[zeros(33,1); c; zeros(33,1)];
ccf=[0; cc(65:128); cc(2:64)];
ccf=conj(ifft(ccf));
w2=conv(x,ccf);
if (doplot)
%plot(10*log10(abs(w2)));%./mean(abs(w2))));
plot(abs(w2))
%axis([0 length(w2) 0 20])
11 years ago
end
[m i]=max(abs(w2));
fs=i-960;
p_m = m/mean(abs(w2));
11 years ago
if doplot
fprintf('Frame starts at %d, m=%g, p=%g, p/m=%g dB\n',fs, ...
mean(abs(w2)), m, 10*log10(m/mean(abs(w2))));
end
end