1.问题描述:
2.部分程序:
clc
clear all
close all
fsamp = 10.046e6;
f0 = 1.023e6; %基准频率
alpha = 1;
alpha2 = 6;
belta = 1;
fc = f0*belta; %伪码速率
fs = f0*alpha; %副载波频率
fc2 = 4e6; %载波频率
%%%%%%%%%%%%%%%%信号源%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SNR = 10;
global adder_code;
global adder_sub_carrier;
global adder_carrier;
fword_code = fc*2^40/fsamp;
adder_code = 0;
fword_sub_carrier = fs*2^40/fsamp;
adder_sub_carrier = 0;
fword_carrier = fc2*2^40/fsamp;
adder_carrier = 0;
global sin_table;
sin_table = sin(2*pi/2048*(0:2047));
global code;
code = gold_gen(1023);
%%%%%%%%%%%%%%%%%%%%local
global local_fword_code;
global local_fword_sub_carrier;
global local_fword_fll;
global local_fword_pll;
global local_adder_fll;
global local_adder_pll;
global local_adder_code;
global local_adder_sub_carrier;
local_adder_code = 0;
local_adder_sub_carrier = 0;
local_adder_fll = 0;
local_adder_pll = 0;
local_fword_code = fword_code+100;
local_fword_sub_carrier = fword_sub_carrier+100;
local_fword_fll = fword_carrier+100;
local_fword_pll = fword_carrier;
global last_local_adder_code;
global last_local_adder_sub_carrier ;
global last_local_adder_fll ;
global last_local_adder_pll;
last_local_adder_code = 0;
last_local_adder_sub_carrier = 0;
last_local_adder_fll = 0;
last_local_adder_pll = 0;
Tcoh = 1e-3; %相干时间
T_track = 4; %仿真跟踪时间
naturefreqDDLL = 1.89*0.5; % 码环的自然频率
IntervalEachprocess_DLL = Tcoh;
coef1_DDL = (sqrt(2)*naturefreqDDLL + naturefreqDDLL^2*IntervalEachprocess_DLL);
coef2_DDL = (sqrt(2)*naturefreqDDLL);
signal_BOC = source_BOC(SNR,2,fword_code,fword_sub_carrier,fword_carrier);
point=round(Tcoh*fsamp);
loopnum = round(T_track/Tcoh);
for index = 1:loopnum
index
[signal_BOC,prn_source] = source_BOC(SNR,point,fword_code,fword_sub_carrier,fword_carrier);
[local_prn_E,local_prn_P,local_prn_L,local_BOC_E,local_BOC_P,local_BOC_L,...
fll_carrier_cos,fll_carrier_sin,pll_carrier_cos,pll_carrier_sin] = local_gen(point);
%% 相关运算
%ASPeCT
Dcm_I_E1 = sum(signal_BOC.*fll_carrier_cos.*local_BOC_E);
Dcm_I_E2 = sum(signal_BOC.*fll_carrier_cos.*local_prn_E);
% Dcm_I_E = Dcm_I_E1^2-Dcm_I_E2^2+abs(Dcm_I_E1^2-Dcm_I_E2^2); %改进的方法
Dcm_I_E = Dcm_I_E1^2-Dcm_I_E2^2; %ASPeCT方法
Dcm_Q_E1 = sum(signal_BOC.*fll_carrier_sin.*local_BOC_E);
Dcm_Q_E2 = sum(signal_BOC.*fll_carrier_sin.*local_prn_E);
% Dcm_Q_E = Dcm_Q_E1^2-Dcm_Q_E2^2+abs(Dcm_Q_E1^2-Dcm_Q_E2^2);
Dcm_Q_E = Dcm_Q_E1^2-Dcm_Q_E2^2;
Dcm_I_P1 = sum(signal_BOC.*fll_carrier_cos.*local_BOC_P);
Dcm_I_P2 = sum(signal_BOC.*fll_carrier_cos.*local_prn_P);
Dcm_I_P = Dcm_I_P1^2-Dcm_I_P2^2+abs(Dcm_I_P1^2-Dcm_I_P2^2);
Dcm_Q_P1 = sum(signal_BOC.*fll_carrier_sin.*local_BOC_P);
Dcm_Q_P2 = sum(signal_BOC.*fll_carrier_sin.*local_prn_P);
Dcm_Q_P = Dcm_Q_P1^2-Dcm_Q_P2^2+abs(Dcm_Q_P1^2-Dcm_Q_P2^2);
Dcm_I_L1 = sum(signal_BOC.*fll_carrier_cos.*local_BOC_L);
Dcm_I_L2 = sum(signal_BOC.*fll_carrier_cos.*local_prn_L);
% Dcm_I_L = Dcm_I_L1^2-Dcm_I_L2^2+abs(Dcm_I_L1^2-Dcm_I_L2^2);
Dcm_I_L = Dcm_I_L1^2-Dcm_I_L2^2;
Dcm_Q_L1 = sum(signal_BOC.*fll_carrier_sin.*local_BOC_L);
Dcm_Q_L2 = sum(signal_BOC.*fll_carrier_sin.*local_prn_L);
% Dcm_Q_L = Dcm_Q_L1^2-Dcm_Q_L2^2+abs(Dcm_Q_L1^2-Dcm_Q_L2^2);
Dcm_Q_L = Dcm_Q_L1^2-Dcm_Q_L2^2;
%% 码鉴别滤波,计算频率字
pow_E = Dcm_I_E^2+Dcm_Q_E^2;
pow_L = Dcm_I_L^2+Dcm_Q_L^2;
code_dis = (pow_E-pow_L)/(pow_E+pow_L)/2;
code_dis_result(index) = code_dis;
if index ==1
last_out_DDL = 0;
last_in_DDL = 0;
end
code_filter = last_out_DDL + [code_dis last_in_DDL]*[coef1_DDL (-1)*coef2_DDL]';
last_out_DDL = code_filter;
last_in_DDL = code_dis;
code_filter_result(index) = code_filter;
local_fword_code = (fc+code_filter)*2^40/fsamp;
local_fword_sub_carrier = (fs+code_filter)*2^40/fsamp;
end
figure(1);title('码环');
subplot(211)
xt = (1:loopnum)*1e-3;
plot(xt,code_dis_result);title('跟踪曲线');grid;xlabel('time/s');ylabel('码相位差/chips');
subplot(212);plot(code_filter_result);title('滤波');
grid on
3.仿真结论:
D-50