Calculate rms value of an an array


Kaly

Recommended Posts

Somehow, I can't find an 'rms' function in Daqfactory. Is there truly no way to calculate the actual rms value of an array? The array may not be a sine wave so I cannot simply divide by the square root of 2. How would one go about obtaining the actual rms value of an array?

Link to comment
Share on other sites

Yup, but I'm not sure how well it will work with quantized data.  The accuracy is going to depend on the sampling interval, and some sort of curve fit might be helpful. 

But ignoring that and assuming you have a channel / array "X" with your data, the RMS calculation in DAQFactory would simply be:

mean(x^2) ^ 0.5

 Remember, doing x^2 returns an array the same size as x, where each value of x is squared.  Mean() takes the mean of whatever array is provided to it.  And ^ 0.5 raises whatever is to the left to the 1/2 power, which is the same as square root.

 

Link to comment
Share on other sites

The field labeled RMS is from the original Daqfactory example. That field calculates RMS value by first determining the peak. That would only work for a true sine wave. I added the 'TrueRMS' field (and some other things). The 'TrueRMS' field should show the true RMS value for any wave shape. Accuracy depends on the field labeled 'capture length'.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.