- added forgetting factor rho = 1-leakiness to LeadLag coeff

git-svn-id: http://moon:8086/svn/software/trunk/libsrc/radio@993 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2022-06-16 08:45:10 +00:00
parent 3adaef0094
commit 2f952a10a0
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -66,10 +66,17 @@ void LeadLagSetCoeff(lead_lag_coeff_t *pCoeff, radio_float_t lead, radio_float_t
{
pCoeff->lead = lead;
pCoeff->lag = lag;
pCoeff->rho = (radio_float_t)1.0;
}
void LeadLagSetLeakiness(lead_lag_coeff_t *pCoeff, radio_float_t leakiness)
{
pCoeff->rho = (radio_float_t)1.0-leakiness;
}
radio_float_t LeadLagProcess(lead_lag_filter_t *pObj, lead_lag_coeff_t *pCoeff, radio_float_t x)
{
pObj->lag_state *= pCoeff->rho;
pObj->lag_state += LEAD_LAG_SCALING*pCoeff->lag * x;
return pObj->lag_state/LEAD_LAG_SCALING + pCoeff->lead * x;