From 8c6d1e29853aadbdd7b6717eedd8ba8559149b79 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Sat, 15 Dec 2018 12:10:04 +0000 Subject: [PATCH] - add loopFilterGain - fixed baudrate estimation git-svn-id: http://moon:8086/svn/matlab/trunk@107 801c6759-fa7c-4059-a304-17956f83a07c --- garage_ip.m | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/garage_ip.m b/garage_ip.m index 36609a6..8e86c6c 100755 --- a/garage_ip.m +++ b/garage_ip.m @@ -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); @@ -92,20 +92,20 @@ smp = []; smp_n = []; bits = []; -v_min = 0; % Threshold max -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_lead = 0.1; % Symbol syncronizer loop filter lead -k_lag = 0.0001; % Symbol syncronizer loop filter lag -lag_accu = 0; % Symbol syncronizer loop filter -k_leak = 0; % Lag forgetting factor -loopThreshold = 0.1; % Processing threshold -ns = 1; % Start sample source -n = 1; % Start sample sink -err = 0; % Error +v_min = 0; % Threshold max +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 = 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 +k_leak = 0; % Lag forgetting factor +loopThreshold = 0.1; % Processing threshold +ns = 1; % Start sample source +n = 1; % Start sample sink +err = 0; % Error while ns < N % Get next interpolated sample is = fix(ns); @@ -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;