MATLAB Answers

Decimate signal that contains NANs

6 views (last 30 days)
Sina Salehi
Sina Salehi on 28 Dec 2019
Edited: Sina Salehi on 10 Jan 2020
Hi
How could I decimate signal that contains NAN values?

  0 Comments

Sign in to comment.

Answers (3)

Ajay Pattassery
Ajay Pattassery on 31 Dec 2019
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 Comments

Sign in to comment.


Sina Salehi
Sina Salehi on 1 Jan 2020
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 Comment

Ajay Pattassery
Ajay Pattassery on 2 Jan 2020
You could make the signal zero whenever NaN appears. There by keeping the position.
x(positionNaN) = 0;

Sign in to comment.


Sina Salehi
Sina Salehi on 10 Jan 2020
Edited: Sina Salehi on 10 Jan 2020
Can't replace NAN data with any arbitary values. They have to be NAN after decimate either.

  0 Comments

Sign in to comment.

Sign in to answer this question.