why NAN happend when i use another signal

i am trying to detect S-wave in QRS complex and it works enough for me but i tryed for another ECG signal it dose not give me error buy the output of all procedure start from filtering to the end is NAn what is the wrong??

1 件のコメント

Image Analyst
Image Analyst 2014 年 5 月 3 日
How can we know why your code gives NaN when you didn't attach your code or your data file. Please read this: http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

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

 採用された回答

Star Strider
Star Strider 2014 年 5 月 3 日
編集済み: Star Strider 2014 年 5 月 3 日

0 投票

The signal you posted is not the signal in the plot you posted. (I do congratulate you on getting your R and S detection routines to work!)
I needed to do some analysis of the signal you posted, because you did not provide us with the sampling frequency (that appears to be 1kHz), and there are 423 ‘NaN’ values I had to dispose of that initially prevented me from calculating the fft.
You have significant amplitude 50Hz powerline noise in your signal (if I’m correct about the sampling frequency). You have to filter that out first. Since all important EKG information is far below that, a simple lowpass filter should work. I will leave the design and implementation of that filter to you, but the Signal Processing Toolbox can do everything you need.
Remember to always look at your data before you process it. At least plot it if that is appropriate, and if necessary, do an fft, summary statistics, or other appropriate analyses.
Filter your signal, and if you have problems finding the peaks in the filtered signal, post that signal, describe your problems, and we will do our best to help.

4 件のコメント

Hasan alomari
Hasan alomari 2014 年 5 月 3 日
thank you for the help the Fs=1000 hz as they told us when we take the ecg power line is 50 hz i try to use the filtering by code and signal process toolbox it work for other signal but this one i dont know why!!!
Star Strider
Star Strider 2014 年 5 月 3 日
編集済み: Star Strider 2014 年 5 月 3 日
My pleasure!
The other signal may have a different sampling frequency. You have to design the filter to the sampling frequency, so not all digital filters will work as designed on all digitised signals.
If the filter was designed to be used with Fs=1kHz signals and doesn’t work with the one you posted, then check the filter’s design and the cutoff and passband frequencies. You can do this with the freqz function.
Hasan alomari
Hasan alomari 2014 年 5 月 3 日
thank you for your help
Star Strider
Star Strider 2014 年 5 月 3 日
My pleasure!

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

その他の回答 (2 件)

Hasan alomari
Hasan alomari 2014 年 5 月 3 日

0 投票

this is the code and the ecg
Jan
Jan 2014 年 5 月 3 日

0 投票

You can use the debugger to step through your code line by line to find out, in which operation the NaNs are produced. If you have specified the corresponding command and still have questions, you can post them again providing more information.

2 件のコメント

Hasan alomari
Hasan alomari 2014 年 5 月 3 日
i try but want work or i dont know where
Image Analyst
Image Analyst 2014 年 5 月 3 日
Then please view this tutorial on the debugger: http://blogs.mathworks.com/videos/2012/07/03/debugging-in-matlab/

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

Community Treasure Hunt

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

Start Hunting!

Translated by