How to force numerator and denominator coefficients to be >0 in tfest?

조회 수: 8 (최근 30일)
Jwven
Jwven 2018년 10월 12일
답변: Michael Hawks 2018년 10월 17일
Hi! I have two timeseries, and I am using tfest to estimate the transfer function between them. I need the coefficients of both the numerator and denominator to be >= 0. Is there anyway I can force this constraint?

답변 (1개)

Michael Hawks
Michael Hawks 2018년 10월 17일
Estimating transfer functions from noisy data can be tricky, but forcing values to be >= 0 is pretty easy so I'll stick to that part of your question.
You could use (for example);
ratio = max( [numerator,0] ) ./ max( [denominator, 0] );
This will replace any negative or NaN values with 0.
Ratios of very small noisy numbers can be unstable, so you can also regularize this a bit with
ratio = ( max( [numerator,0] ) + eps ) ./ ( max( [denominator, 0] ) + eps );
eps is a built-in variable that is essentially the least-significant bit in floating point notation, so this adds a tiny amount onto both numerator and denominator. This only matters for very very small values, but avoids the ratio blowing up for denominator near zero, and approaches 1 in the limit of both numerator and denominator going to zero.

카테고리

Help CenterFile Exchange에서 Transfer Function Models에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by