matlab仿真gps的毕业论文设计开题报告(编辑修改稿)内容摘要:

index1=find(x1==0)。 %找出 x1数组中为 0的元素 x1(index1)=ones(1,length(index1))。 %返回一个 index1 x2=rand(1,length(t))。 x2=round(x2)。 index1=find(x2==0)。 x2(index1)=ones(1,length(index1))。 x3=rand(1,length(t))。 x3=round(x3)。 index1=find(x3==0)。 x3(index1)=ones(1,length(index1))。 y1=zeros(1,1)。 y2=zeros(1,1)。 y3=zeros(1,1)。 %生成三个 1*1的零矩阵,存放伪 t1=zeros(1,1)。 t2=zeros(1,1)。 t3=zeros(1,1)。 %生成三个 1*1 的零矩阵,存放时 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%将生成的伪随机值存放到对应的矩阵中 %%%%%% y1(1)=x1(1)。 y2(1)=x2(1)。 y3(1)=x3(1)。 t1(1)=t(1)。 t2(1)=t(1)。 t3(1)=t(1)。 k=2。 m=2。 n=2。 for i=2: length(t) if (x1(i)==x1(i1)) y1(k)=x1(i)。 t1(k)=t(i)。 k=k+1。 else y1(k)=x1(i1)。 y1(k+1)=x1(i)。 t1(k)=t(i)。 t1(k+1)=t(i)+。 %如果该时刻阶跃变化, 则右移 k=k+2。 end if (x2(i)==x2(i1)) y2(m)=x2(i)。 t2(m)=t(i)。 m=m+1。 else y2(m)=x2(i1)。 y2(m+1)=x2(i)。 t2(m)=t(i)。 t2(m+1)=t(i)+。 m=m+2。 湖北大学本科毕业论文(设计) end if (x3(i)==x3(i1)) y3(n)=x3(i)。 t3(n)=t(i)。 n=n+1。 else y3(n)=x3(i1)。 y3(n+1)=x3(i)。 t3(n)=t(i)。 t3(n+1)=t(i)+。 n=n+2。 end end %%%%%%画图说明产生的三组伪随机码 %%%%% subplot(3,1,1)。 plot(t1,y1,′ y′ )。 grid on。 axis([ 1,1001,] )。 subplot(3,1,2)。 plot(t2,y2,′ y′ )。 grid on。 axis([ 1,1001,] )。 subplot(3,1,3)。 plot(t3,y3,′ y′ )。 grid on。 axis([ 1,1001,] )。 whitebg(′ black′ )。 %将三组伪随机值存放到新矩阵并传送到 Workspace中, 方便以后调用数据 % simin1=[ t1。 y1]′。 simin2=[ t2。 y2]′。 simin3=[ t3。 y3]′。 输入上 面的文本后,运行得到如图 529所示的伪随机码。 其结果还可以通过 Workspace查看,之所以要传送到 Workspace中, 是因为我们在后面的仿真中还要用到这些伪随机码。 湖北大学本科毕业论文(设计) 图 模拟三组伪随机码的仿真示意图 获取导航信息的仿真 在这个仿真中,我们要得到卫星的导航信息,其中忽略了频率偏移,且卫星信号的数据是基于前面章节中得到的卫星数据,存放在。 在运行程序之前, 我们必须将 Workspace中。 clear。 % clc。 % close all。 % load %从 Workspace中 %n=length(GPSsignal)。 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SvNum=12。 %调用 , 获得卫星编 号为 12的 C/A Temp=fGenerateCAcode3(SvNum)。 index1=find(Temp==0)。 %找出 C/A码中的低电平, 形成列向量存放在 index1中 Temp(index1)=ones(1,length(index1))。 %返回一个与 index1相同长 度的一维数组 SinWave=sin([ 0:2*pi/8:2*pi*7/8] )。 %产生一个步进 2*pi/8 湖北大学本科毕业论文(设计) SinWave=single(SinWave)。 %将 SinWave GpsMatch=zeros(1,1)。 %生成一个 1*1 SinWave=[ SinWave SinWave SinWave SinWave SinWave]。 %生成一个 5 ms for i=1:length(Temp) GpsMatch=[ GpsMatch Temp(1,i)*SinWave]。 end GpsMatch=GpsMatch(2:length(GpsMatch))。 % n=length(GpsMatch)。 m=50000。 for i=1:m Res(i)=GpsMatch*GPSsignal(1,i:i+n1)′。 %将本地生成匹配信号 GpsMatch与 GPSsignal循环卷积 end plot(1:m,Res)。 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Res2=abs(Res)。 for i=1:100 %该循环目的是找出 Res [ C I] =max(Res2)。 Res2(1,I)=0。 Index(1,i)=I。 end。 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %下面是要找到 GPS signal中的导航电文 % %方法是检验 GPS signal(已被 C/A code 调制过 )的每个最大值处是否具 有相位偏移 % w=length(GpsMatch)。 m=1。 for i=Index(1,1):w:(length(GPSsignal)w+1) NavigationBit(m)=(GPSsignal(i:i+w1)*GpsMatch′ )/w。 m=m+1。 end NavigationCode=zeros(1,1)。 NavigationCode(1,1)=NavigationBit(1,1)。 m=2。 Count=0。 for i=2:length(NavigationBit) if(NavigationBit(1,i)~ =NavigationBit(1,i1)) NavigationCode(1,m)=NavigationBit(1,i)。 m=m+1。 Count=0。 else Count=Count+1。 湖北大学本科毕业论文(设计) if(Count=5) NavigationCode(1,m)=NavigationBit(1,i)。 m=m+1。 Count=0。 end end end %%%%%我们已得到导航码 NavigationCode,下面将它转化成数字 %%%% NavigationCode=NavigationCode./abs(NavigationCode)。 index1=find(NavigationCode0)。 NavigationCode(index1)=zeros(1,length(index1))。 Table1=[ 0 0 0 0。 0 0 0 1。 0 0 1 0。 0 0 1 1。 0 1 0 0。 0 1 0 1。 0 1 1 0。 0 1 1 1。 1 0 0 0。 1 0 0 1。 1 0 1 0。 1 0 1 1。 1 1 0 0。 1 1 0 1。 1 1 1 0。 1 1 1 1。 ]。 Result=″。 for i=1:4:length(NavigationCode) TT=NavigationCode(i:i+3)。 MatchTable=Table1(:,1:4)[ TT。 TT。 TT。 TT。 TT。 TT。 TT。 TT。 TT。 TT。 TT。 TT。 TT。 TT。 TT。 TT]。 MatchTable=sum(abs(MatchTable)′ )。 TempChar=′ 0′。 BestMatch=find(MatchTable==min(MatchTable))。 %用查表的方式将导航码 NavigationCode switch (BestMatch) case 1 TempChar=′ 0′。 case 2 TempChar=′ 1′。 case 3 TempChar=′ 2′。 case 4 湖北大学本科毕业论文(设计) TempChar=′ 3′。 case 5 TempChar=′ 4′。 case 6 TempChar=′ 5′。 case 7 TempChar=′ 6′。 case 8 TempChar=′ 7′。 case 9 TempChar=′ 8′。 case 10 TempChar=′ 9′。 case 11 TempChar=′ a′。 case 12 TempChar=′ b′。 case 13 TempChar=′ c′。 case 14。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。