Decimate signal that contains NANs
9 次查看(过去 30 天)
显示 更早的评论
Hi
How could I decimate signal that contains NAN values?
0 个评论
回答(3 个)
Ajay Pattassery
2019-12-31
I understand you want to decimate signals that contain NaN.
I assume you would like to decimate a signal by a factor r if it contains NaN values.
I have removed the NaN values from the signal and then decimate it as follows.
x is assumed as the signal.
positionNaN = isnan(x);
x(positionNaN) = [];
y = decimate(x,r) ;
Here positionNaN is a logical array of the same size as x containing 1 whenever a NaN value is present otherwise zero.
0 个评论
Sina Salehi
2020-1-1
1 个评论
Ajay Pattassery
2020-1-2
You could make the signal zero whenever NaN appears. There by keeping the position.
x(positionNaN) = 0;
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!