⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pnmabuhuol.m

📁 GPS的pn码捕获matlab仿真程序
💻 M
字号:
function [codephase,frequency] = acquisitionSerial(svnum)
% Performs serial search acquisition on collected data
% Searches for the satellite with number svnum
% Returns the code phase and the coarse frequency of the signal

% ***** initial conditions *****
load data.mat
x=double(data');

fs=11.999e6;	% sampling freq
ts=1/fs;	% sampling time
n=fs/1000;	% data pt in l ms
nn=[0:n-1];	% total no. of pts
fc0=3.563e6;	% center freq without Doppler

% ***** Reads code with 1024 different phases
filename=sprintf('gold%i.mat',svnum);
load(filename);
code=double(code);

y = ones(1023,1);
xcarrier = (y*x).*code;

% ***** Serial Search Algorithm *****
for i=1:41
  fc(i) = fc0 + 0.0005e6*(i-21);
  expfreq=exp(j*2*pi*fc(i)*ts*nn);
  sine= imag(expfreq);			% generate local sine
  cosine= real(expfreq);		% generate local cosine 
  I = (y*sine).*xcarrier;
  Q = (y*cosine).*xcarrier;    
  result(i,:)=sum(I').^2+sum(Q').^2;
end

[peak codephase]=max(max(result));
[peak frequency]=max(max(result'));

frequency = fc(frequency);

figure(1)
x_axis=1:1023;
y_axis=fc/1e6;
s=surf(x_axis,y_axis,result);
set(s,'EdgeColor','none','Facecolor','interp');
axis([min(x_axis) max(x_axis) min(y_axis) max(y_axis) min(min(result)) max(max(result))]);
caxis([0 max(max(result))]);
xlabel('Code Phase [chips]');
ylabel('Frequency [MHz]');
zlabel('Magnitude');
text=sprintf('SVN %i',svnum);
title(text);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -