Root Mean Square Value of Histogram
Show older comments
How do I find the root mean square value of this histogram?

The data is Histo = [1;47;56;1298;9770;1114;0;0;2]
Accepted Answer
More Answers (1)
Image Analyst
on 15 Jan 2018
Amy:
I just want to make sure you realize that the RMS of the original data values is not the same as the RMS of the bin locations (what Rik gave you), and neither is the same as the RMS of the bin heights. Yo DO know that don't you? So, which do you want? I give an illustration of all 3 in the demo code below, and you can see how they're different.
r = randn(20);
h = histogram(r)
counts = h.Values'
edges = h.BinEdges'
binCenters = (edges(1:end-1) + edges(2:end))/2
mean_of_squared_values = sum(counts.*(binCenters.^2))/sum(counts);
% Compute the RMS value of the bin center locations.
rmsCenters = sqrt(mean_of_squared_values)
% Compute the RMS value of the bin heights (counts).
rmsCounts = rms(counts)
% Compute the RMS of the actual data values.
rmsValues = rms(r(:))
% They're not the same!
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!