localcarriercodegen.m

来自「Galileo BOC 码产生捕获相关仿真结果」· M 代码 · 共 29 行

M
29
字号

function [LocalCarrierCode,LastChipPhase,LastCarrierPhase]=LocalCarrierCodeGen(svnum,length,fc,Chipphase,Carrierphase)

% svnum: the PRN number;
% length: the number of points that will be generated,reference fs as the
%           sample frq;
% fc; the carrier's center frq;
% Chipphase: the c/a code's beginning phase, united by half of the chip;
% Carrierphase: the carrier's beginning phase, united by 2*pi;

fs=4.8e+6;
Rc=1.023e+6;
Amplitue=2; 
ChipsPerCycle=1023;

GoldCode=CACodeGen(svnum);

code_index=mod(floor([0:length-1]*Rc/fs+Chipphase),ChipsPerCycle)+1;
localcode=GoldCode(code_index);
LastChipPhase=mod( floor( length * Rc / fs + Chipphase ),ChipsPerCycle);

carrier_index=mod( Carrierphase + [0:length-1]*fc/fs, 1 );
LastCarrierPhase=mod( Carrierphase + length*fc/fs,1 );
localcarrier= Amplitue * cos(2*pi* carrier_index );

LocalCarrierCode = localcode .* localcarrier;
partition = linspace(-Amplitue, +Amplitue, 6 );
codebook=[-3:3];
[index,LocalCarrierCode] = quantiz(LocalCarrierCode,partition,codebook);

⌨️ 快捷键说明

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