Decimate signal that contains NANs

10 ビュー (過去 30 日間)
Sina Salehi
Sina Salehi 2019 年 12 月 28 日
編集済み: Sina Salehi 2020 年 1 月 10 日
Hi
How could I decimate signal that contains NAN values?

回答 (3 件)

Ajay Pattassery
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.

Sina Salehi
Sina Salehi 2020 年 1 月 1 日
Hi Ajay
My signal is time seriese and I need to keep the position of each values including NANs. So I can not easily removing NANs.
Thanks,
  1 件のコメント
Ajay Pattassery
Ajay Pattassery 2020 年 1 月 2 日
You could make the signal zero whenever NaN appears. There by keeping the position.
x(positionNaN) = 0;

サインインしてコメントする。


Sina Salehi
Sina Salehi 2020 年 1 月 10 日
編集済み: Sina Salehi 2020 年 1 月 10 日
Can't replace NAN data with any arbitary values. They have to be NAN after decimate either.

カテゴリ

Help Center および File ExchangeNaNs についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by