RMS Function Returns NAN

55 ビュー (過去 30 日間)
Mark Lafrentz
Mark Lafrentz 2019 年 6 月 11 日
コメント済み: Mark Lafrentz 2019 年 6 月 12 日
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 日
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 件)

カテゴリ

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

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by