Searching \ for 'RMS = sum of squares?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/index.htm?key=rms+sum+squares
Search entire site for: 'RMS = sum of squares?'.

Truncated match.
PICList Thread
'RMS = sum of squares?'
2000\03\23@002544 by Lorick

flavicon
face
Back on the topic of measuring an analog signal and calculating RMS, I'm
stuck on a certain thought.
If I take 255 or 256 readings that are all read exactly at the peak of 255,
and I accumulate a sum of squares of 255, then divide by the number of
samples and take the squareroot, I'm left with 255...which is the peak
value...
So how can that be RMS?

2000\03\23@003756 by David Lions

flavicon
face
That is an 'aliasing' problem.  For your samples to have any meaning you
have to sample at a much higher rate than the highest frequency in your
signal.   In theory, more than 2x is required, but in practice you would
sample as quickly as possible.  Imagine the same situation but sampling a
thousand times faster...then you are sure not to just sample peaks all the
time.


At 12:15 AM 3/23/00 -0500, you wrote:
>Back on the topic of measuring an analog signal and calculating RMS, I'm
>stuck on a certain thought.
>If I take 255 or 256 readings that are all read exactly at the peak of 255,
>and I accumulate a sum of squares of 255, then divide by the number of
>samples and take the squareroot, I'm left with 255...which is the peak
>value...
>So how can that be RMS?
>
>

David Lions
Lab Technician
Miva Corporation

2000\03\23@004207 by Spehro Pefhany

picon face
At 12:15 AM 3/23/00 -0500, you wrote:
>Back on the topic of measuring an analog signal and calculating RMS, I'm
>stuck on a certain thought.
>If I take 255 or 256 readings that are all read exactly at the peak of 255,
>and I accumulate a sum of squares of 255, then divide by the number of
>samples and take the squareroot, I'm left with 255...which is the peak
>value...
>So how can that be RMS?

You have discovered 'aliasing', you need to get many more samples than
one per cycle. If the input is DC, you would get each measurement the
same, and the RMS value *is* the same as the peak value for DC.

Best regards,




=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Spehro Pefhany                                    "The Journey is the reward"
spam_OUTspeffTakeThisOuTspaminterlog.com
Fax:(905) 271-9838                      (small micro system devt hw/sw + mfg)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

2000\03\23@015232 by Roland Andrag

flavicon
face
Lorick,

I'm not sure if your problem is with the RMS (root mean square) algorithm,
which you have decribed prefectly below, of if you are worried about all
samples being taken at the 'peak' of whatever waveform you are measuring.

You decribed the RMS algorithm perfectly, i.e. work out the square root of
the mean of the squares of all samples taken.  To ensure that all your
samples are not taken at the peak as in your example, you have to refer to
the Nyquist theorem, which states that you have to sample at *at least*
twice the frequency of the highest frequency signal present in whatever you
are sampling.

That means that if you are measuring a 50 Hz waveform you should be taking
at least 100 samples per second, preferably something like 200.  In this
case all of your samples could never end up being taken on the peaks since
you are sampling fast enough to catch the waveform between the peaks as
well.

Hope that clears it up

Roland
{Original Message removed}

2000\03\23@015646 by Lorick

flavicon
face
> That is an 'aliasing' problem.  For your samples to have any meaning you
> have to sample at a much higher rate than the highest frequency in your
> signal.

This is an issue I'm going to be dealing with soon (sampling rate info) and
so I guess I'll start asking about it now...
I'll be looking at the 16F876 data sheets again and I don't know if they
have the information or not yet, but just in case anyone has a quick answer,
how do I figure out my sampling rate with the microcontroller?

ie what does it depend on exactly?  Here is my most current situation.
A pic at 4MHz doing a/d on 2 inputs, doing a running sum of squares between
individual samples per channel, so I'll first only deal with channel 1.
Take a single sample, square it, add it to a 24bit accumulator
Take another sample etc.
Total number of sequential samples unknown...
Then divide the accumulator by the number of samples of course and MAYBE
squareroot it, although my application uses the square of the reading anyway
so it would be redundant to sqrt right now.

Then do the exact same on channel 2.
So what would sample rate depend on if I'm doing math in between readings?
Do I calculate all the tedious timing info of the summing and squaring and
see how many samples end up fitting in a unit of time (second?) and call
that the sample rate?

2000\03\23@075207 by hgraf

picon face
> Back on the topic of measuring an analog signal and calculating RMS, I'm
> stuck on a certain thought.
> If I take 255 or 256 readings that are all read exactly at the
> peak of 255,
> and I accumulate a sum of squares of 255, then divide by the number of
> samples and take the squareroot, I'm left with 255...which is the peak
> value...
> So how can that be RMS?

       AFAIK that is the RMS, the way I like to think about RMS is it is the value
of DC that an AC signal "aspires" to be. TTYL

2000\03\23@124237 by Harold M Hallikainen

picon face
On Thu, 23 Mar 2000 00:15:14 -0500 Lorick <.....lorickKILLspamspam@spam@AIR.ON.CA> writes:
> Back on the topic of measuring an analog signal and calculating RMS,
> I'm
> stuck on a certain thought.
> If I take 255 or 256 readings that are all read exactly at the peak
> of 255,
> and I accumulate a sum of squares of 255, then divide by the number
> of
> samples and take the squareroot, I'm left with 255...which is the
> peak
> value...
> So how can that be RMS?


       Because the RMS of a DC value is the DC value itself.

Harold


FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
dl.http://www.juno.com/get/tagj.

2000\03\23@124448 by Harold M Hallikainen

picon face
       I believe you need to sample above the Nyquist rate (at least two times
the highest frequency to be represented) IF you want to faithfully
reproduce the signal by doing a D/A at the other end. I don't think you
are trying to do this with your RMS measurement. So, it appears the
actual sample rate is irrelevant. You can randomly sample the signal,
compute the square, accumulate the squares, divide by the number of
samples, then take the square root to get the RMS. The key thing here is
RANDOM samples. If you always sample on the peak of the waveform, you'll
get the RMS of a DC signal corresponding to the peak. This undersampling
needs to be at a rate that is not a subharmonic of the frequency of the
signal you are measuring. If it were on a subharmonic, you'd end up at
the same point on the waveform every time.

Harold



FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

________________________________________________________________
YOU'RE PAYING TOO MUCH FOR THE INTERNET!
Juno now offers FREE Internet Access!
Try it today - there's no risk!  For your FREE software, visit:
dl.http://www.juno.com/get/tagj.

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...