- add loopFilterGain

- fixed baudrate estimation

git-svn-id: http://moon:8086/svn/matlab/trunk@107 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
2018-12-15 12:10:04 +00:00
parent 7b06d60372
commit 8c6d1e2985
+4 -4
View File
@@ -24,8 +24,8 @@
function [bits] = garage_ip (varargin)
params = struct ('x', [], 'sampleRate', 48000, 'numSamplesPerSym', 16, 'with_filter', 0, 'k_noise', 0.00);
units = struct ('x', '', 'sampleRate', '1/s', 'numSamplesPerSym', 'sps', 'with_filter', '', 'k_noise', '');
params = struct ('x', [], 'sampleRate', 48000, 'numSamplesPerSym', 16, 'loopFilterGain', 1.0, 'with_filter', 0, 'k_noise', 0.00);
units = struct ('x', '', 'sampleRate', '1/s', 'numSamplesPerSym', 'sps', 'loopFilterGain', '', 'with_filter', '', 'k_noise', '');
% Parse parameters
names = fieldnames(params);
@@ -97,7 +97,7 @@ v_max = 0; % Threshold min
hyst_thr = 0.5; % Threshold hysteresis
rho_thr = 1e-5; % Threshold forgetting factor
alpha_thr = 0.1; % Min/Max update factor
k_leadLag = 2.0; % Overall loopfilter gain (scales k_lead and k_lag)
k_leadLag = params.loopFilterGain; % Overall loopfilter gain (scales k_lead and k_lag)
k_lead = 0.1; % Symbol syncronizer loop filter lead
k_lag = 0.0001; % Symbol syncronizer loop filter lag
lag_accu = 0; % Symbol syncronizer loop filter
@@ -156,7 +156,7 @@ while ns < N
vcorr = k_leadLag*k_lead*err + lag_accu;
lag_accu = lag_accu + k_leadLag*k_lag*err;
lag_accu = lag_accu * (1-k_leak);
baud = (1+vcorr)*fs/numSamplesPerSym;
baud = fs/((1+vcorr)*numSamplesPerSym);
_err(n) = err;
_baud(n) = baud;
_cnt(n) = vcorr;