- 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:
+17
-17
@@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
function [bits] = garage_ip (varargin)
|
function [bits] = garage_ip (varargin)
|
||||||
|
|
||||||
params = struct ('x', [], 'sampleRate', 48000, 'numSamplesPerSym', 16, 'with_filter', 0, 'k_noise', 0.00);
|
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', 'with_filter', '', 'k_noise', '');
|
units = struct ('x', '', 'sampleRate', '1/s', 'numSamplesPerSym', 'sps', 'loopFilterGain', '', 'with_filter', '', 'k_noise', '');
|
||||||
|
|
||||||
% Parse parameters
|
% Parse parameters
|
||||||
names = fieldnames(params);
|
names = fieldnames(params);
|
||||||
@@ -92,20 +92,20 @@ smp = [];
|
|||||||
smp_n = [];
|
smp_n = [];
|
||||||
bits = [];
|
bits = [];
|
||||||
|
|
||||||
v_min = 0; % Threshold max
|
v_min = 0; % Threshold max
|
||||||
v_max = 0; % Threshold min
|
v_max = 0; % Threshold min
|
||||||
hyst_thr = 0.5; % Threshold hysteresis
|
hyst_thr = 0.5; % Threshold hysteresis
|
||||||
rho_thr = 1e-5; % Threshold forgetting factor
|
rho_thr = 1e-5; % Threshold forgetting factor
|
||||||
alpha_thr = 0.1; % Min/Max update 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_lead = 0.1; % Symbol syncronizer loop filter lead
|
||||||
k_lag = 0.0001; % Symbol syncronizer loop filter lag
|
k_lag = 0.0001; % Symbol syncronizer loop filter lag
|
||||||
lag_accu = 0; % Symbol syncronizer loop filter
|
lag_accu = 0; % Symbol syncronizer loop filter
|
||||||
k_leak = 0; % Lag forgetting factor
|
k_leak = 0; % Lag forgetting factor
|
||||||
loopThreshold = 0.1; % Processing threshold
|
loopThreshold = 0.1; % Processing threshold
|
||||||
ns = 1; % Start sample source
|
ns = 1; % Start sample source
|
||||||
n = 1; % Start sample sink
|
n = 1; % Start sample sink
|
||||||
err = 0; % Error
|
err = 0; % Error
|
||||||
while ns < N
|
while ns < N
|
||||||
% Get next interpolated sample
|
% Get next interpolated sample
|
||||||
is = fix(ns);
|
is = fix(ns);
|
||||||
@@ -156,7 +156,7 @@ while ns < N
|
|||||||
vcorr = k_leadLag*k_lead*err + lag_accu;
|
vcorr = k_leadLag*k_lead*err + lag_accu;
|
||||||
lag_accu = lag_accu + k_leadLag*k_lag*err;
|
lag_accu = lag_accu + k_leadLag*k_lag*err;
|
||||||
lag_accu = lag_accu * (1-k_leak);
|
lag_accu = lag_accu * (1-k_leak);
|
||||||
baud = (1+vcorr)*fs/numSamplesPerSym;
|
baud = fs/((1+vcorr)*numSamplesPerSym);
|
||||||
_err(n) = err;
|
_err(n) = err;
|
||||||
_baud(n) = baud;
|
_baud(n) = baud;
|
||||||
_cnt(n) = vcorr;
|
_cnt(n) = vcorr;
|
||||||
|
|||||||
Reference in New Issue
Block a user