How does fillgaps work?
4 次查看(过去 30 天)
显示 更早的评论
Hello!
I was wondering how https://www.mathworks.com/help/signal/ref/fillgaps.html works. As it is implied, fillgaps replaces any NaNs present in a signal x with estimates extrapolated from forward and reverse autoregressive fits of the remaining samples. As far as i know, an autoregressive model specifies that the output variable depends linearly on its own previous values and on a stochastic term. So, why it is written that forward values are also taken into account?
Is there an equation for the fillgaps command? As well as an explanation of its parameters?
Please, i really need an answer on this topic.
Thanks in advance!
回答(1 个)
Ondrej Mokrý
2024-1-16
Consider a signal with only a single gap for simplicity. The function fillgaps takes the context prior to the gap (cropped to length maxlen, if this parameter is set), estimates an AR model for this context (the order of this model can also be set) and uses this model to predict (extrapolate) the missing samples one by one, given the linear dependence governed by the estimated coefficients of the AR model.
For a signal segment x and model order p, we can efficiently perform extrapolation of n samples (e.g., corresponding to length of the gap) as follows:
af = arburg(x, p); % length of the signal x has to be at least p+1
zf = filtic(1, af, flip(x(end-p+1:end)));
prediction = filter(1, af, zeros(1, n), zf); % produces the extrapolated segment of length n
To utilize also the samples coming after the gap, fillgaps repeats the same extrapolation procedure with flipped (reversed) version of this context after the gap. Clearly, this reverse extrapolation has to be flipped again to fit the original signal.
The forward and backward predictions are then linearly cross-faded to produce the final signal filled in the gap.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Signal Modeling 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!