資源簡介
鎖頻環(huán)能實(shí)現(xiàn)仿真,待修改自己的鑒頻方法和濾波方法
代碼片段和文件信息
%---------------------------------------------------------------------%
%-------------------------FLL-----------------------------------------%
%---------------------------------------------------------------------%
clc;
????fs?=?16.368e6; %[Hz] 采樣頻率
fi?=?4.090e6; %[Hz] 中頻頻率
????T?=?0.001; %[s] 積分清除時(shí)間1ms
????n_accum?=?T?*?fs; %????? 積分清除點(diǎn)數(shù)
????CNR?=?44; % ?? 載噪比44dB==-130dBmw
????SNR?=?CNR?-10*log10(fs); % ?? 由載噪比得到信噪比
????addnoise?=?1; %?1:?加噪聲;?0:?不加噪聲
????fd0?=?300; %[Hz]? 多普勒初始頻率
????detfd?=?1000; %[Hz/s] 多普勒變化率
????kf?=?2^32/fs; % 頻率控制字轉(zhuǎn)換系數(shù)
????time?=?0.5; % 仿真時(shí)間和仿真次數(shù)
????loopnum?=?fix(time/T); % 仿真點(diǎn)數(shù)/環(huán)路更新次數(shù)
????b_fll?=?0.9; %[Hz] 鎖頻環(huán)帶寬
????wn?=?1.89?*?b_fll; % 阻尼系數(shù)為0.707下中心頻率
????gain_nco?=?2*pi*fs/2^32; % NCO增益
????gain_disctim?=?1; % 鑒相器增益
????K?=?gain_nco?*?gain_disctim;% 環(huán)路增益:NCO*鑒相器????
????k1?=?0.3; %?修改自己的濾波系數(shù)
????k2?=?0.2; %修改自己的濾波系數(shù)
%?New?FLL-------------------------------------------------------------
fllDampingRatio =?0.7; %?
fllNoiseBandwidth =?3; %[Hz]
fllCoherentT =?0.001; %?Coherent?Time
%?FLL?parameter?calculation?accroding?to?settings-------
[tau1Fll?tau2Fll]?=?calcLoopCoef(fllNoiseBandwidth?...
fllDampingRatio?K);
oldFllNco???=?0.0;
oldFllError?=?0.0;
oldoldFllNco?=?0.0;
????endlasttime?=?0;
????
????fd_estimate?=?0;
????phaseadder?=?0;
????
????past_I_accum?=?0;
????past_Q_accum?=?0;
????
????freqoutdlf?=?0;
????past_past_freqoutdlf?=?0;
????past_freqoutdlf?=?0;
????past_freqerror?=?0;
freq?=?zeros(1loopnum);
for?index?=?1?:?loopnum
????t?=?endlasttime?+?(1:n_accum)/fs;
????????????phase?=?2*pi*?[(fi+fd0)*t?+?1/2*detfd*t.^2];
%????????????phase?=?2*pi*(fi+fd)*(endlasttime?+?(1:n_accum)/fs);
????????????endlasttime?=?endlasttime?+?T;
????????????freq(index)?=?fd0?+?detfd*endlasttime;
????????????cos_signal?=?cos(phase);
????????if?addnoise?==?0
????????????cos_source?=?cos_signal;
????????e
評論
共有 條評論