RMS Function Returns NAN

49 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by