I am using the 'rms' function to calculate root mean squared values. For certain portions of data, the function returns NAN. There is good, non-zero data in the array i'm inputting (2000 data points all non-zero). I know how to calculate rms values myself, but for the sake of learning, i would like to know why this is happening.

 채택된 답변

Greg Dionne
Greg Dionne 2019년 6월 11일

0 개 추천

It's likely you have NaN in your input, or your input is an empty vector.
If you wish to exclude NaN values from computation, then you can try:
sqrt(mean(x .* x, 'omitnan'))
Hope this helps,
-Greg

댓글 수: 1

Mark Lafrentz
Mark Lafrentz 2019년 6월 12일
You were right. I had one NAN in my data set. Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2018b

태그

질문:

2019년 6월 11일

댓글:

2019년 6월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by