How to force numerator and denominator coefficients to be >0 in tfest?
12 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Transfer Function Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!