?? reivesignalfft.m
字號:
clc;clear;close all;
%功能:實現相關器的頻域實現功能
%作者:yy
%導航信息
NavigationData1=rand(1,20);
NavigationData1=round(NavigationData1);
index1=find(NavigationData1==0);
NavigationData1(index1)=-ones(1,length(index1));
NavigationData1(1)=1;%產生隨機數
SvNum=2;
CA1=fGenerateCAcode3(SvNum);
index1=find(CA1==0);
CA1(index1)=-ones(1,length(index1));
CA1=[CA1 CA1 CA1 CA1 CA1];
GpsMatch=zeros(1,1);
for i=1:length(NavigationData1)
GpsMatch=[GpsMatch NavigationData1(1,i)*CA1];%擴頻
end
GpsMatch(:,1)=[];
len_GpsMatch=length(GpsMatch);
shift=1000;%移位計數
GpsMatchtemp(1,1:shift)=GpsMatch(1,len_GpsMatch-shift+1:len_GpsMatch);
GpsMatchtemp(1,shift+1:len_GpsMatch)=GpsMatch(1,1:len_GpsMatch-shift);%左移一位
GpsMatch=GpsMatchtemp;%產生擴頻數
%%%%%%%%%%作相關
FFTn=1024;
FFT_sig2=fft(CA1,FFTn);
mag_sig2=FFT_sig2.*conj(FFT_sig2);%本地擴頻碼作FFT
figure(123)
plot(mag_sig2);
FFT_sig3=fft(GpsMatch,FFTn);
FFT_sig4=fft(CA1,FFTn);
FFT_sign5=conj(FFT_sig4);%共軛
FFT_MUT=FFT_sig3.*FFT_sign5;
figure(12)
plot(FFT_MUT);
IFFTx=ifft(FFT_MUT);
mag_IFFT=IFFTx.*conj(IFFTx);
figure(13)
plot(mag_IFFT);
index2=find(mag_IFFT==max(mag_IFFT));%相關結果中
index2%
GpsMatchtemp(1,1:len_GpsMatch-index2+1)=GpsMatch(1,index2:len_GpsMatch);
GpsMatchtemp(1,len_GpsMatch-index2+1:len_GpsMatch)=GpsMatch(1,1:index2);%右移
GpsMatch2=GpsMatchtemp;%產生擴頻數
%去掉擴頻碼
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -