Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with RMS value for offset squarewave

2,288 views
Skip to first unread message

Martin Hallett

unread,
Jul 4, 2002, 3:20:37 PM7/4/02
to
Hi,
Can anyone help me calculate the RMS value for a squarewave which is offset
by some DC voltage? I can understand how you get the average voltage -
which seems strange because it seems that the average voltage doesn't change
until the offset is greater than the AC peak value. But, am I right that
the RMS value will keep going up from an offset of zero to however far you
want to shift the squarewave?
In this case, is it still the RMS that provides the DC equivalent power?
Thanks


Ratch

unread,
Jul 4, 2002, 5:56:08 PM7/4/02
to

"Martin Hallett" <mar...@least1.demon.co.uk> wrote in message
news:1025810439.17040....@news.demon.co.uk...

> Hi,
> Can anyone help me calculate the RMS value for a squarewave which is
offset
> by some DC voltage?

Yes, I can help you.

>I can understand how you get the average voltage -
> which seems strange because it seems that the average voltage doesn't
change
> until the offset is greater than the AC peak value.

Oh yes it does. Here's why. If you start off with a AC wave, whose
area defined by the magnitude multiplied the time, is the same above the
horizontal axis as it is below, then the average value of the wave will be
zero. Any offset added/subtracted to that wave will force it to spend
more/less time above/below the horizontal axis and increase/decrease its
average value. In this particular case, its average value will simply be
the DC offset voltage.

>But, am I right that
> the RMS value will keep going up from an offset of zero to however far you
> want to shift the squarewave?

A wave whose average value is zero will have a finite RMS value greater
than zero. The RMS value will increase even more when an offset is
added/subtracted. Here is how that works. You have a multi frequency
problem here. To get the RMS value of a wave composed of several frequency
components, you take the square root of the sum of the squares of the RMS
value of each component. Let's see how that works in your case. Assume you
have a square wave at whatever frequency with no offset, whose peak value is
3 volts. That means that its value is 3 volts for part of the cycle and -3
volts for the rest of the cycle. Its RMS value is 3 volts because -3 volts
DC volts dissipates as much energy as +3 volts DC does. Now lets assume a
offset of 4 volts. The wave is composed of two frequency components, a DC
component whose frequency is zero, and a square wave whose RMS value is 3
volts. Applying the formula given, we get SQRT(4*4+3*3) = 5 volts. So a 3
volt square wave riding on top of a 4 volt offset has a RMS value of 5
volts. Its maximum value will be 4+3=7 volts and its minimum value will be
4-3=1 volt.

> In this case, is it still the RMS that provides the DC equivalent power?

The above mentioned square wave will be equivalent to 5 volts DC as far
as power dissipation is concerned. Ratch

> Thanks

You are welcome. Ratch

Don Kelly

unread,
Jul 4, 2002, 6:03:58 PM7/4/02
to


"Martin Hallett" <mar...@least1.demon.co.uk> wrote in message
news:1025810439.17040....@news.demon.co.uk...

For the average not changing until the offset is greater than the AC peak
value- something is definitely wrong. Note that if you have a non-offset AC
value, its average is 0, With the AC component offset by some DC quantity ,
the average value is simply the DC value. Example a square wave from +2
to -1 (offset 0.5) the average is
(2*pi-1*pi)/2pi = 0.5 Check the expression you are using to calculate
average.

For rms the value is given by the square root of the average of the squared
value over the period. (that is the "root mean square")
For a non offset square wave of +1.5 to -1.5 the rms value is 1.5
For this wave offset by 0.5 the rms value is 1.58
Note that you can calculate the rms value in terms of the components
Irms =root(I1rms^2 +I2rms^2 +..)
In this case the DC has an rms value of 0.5 and AC portio has a value of 1.5
Irms =root (0.5^2 +1.5^2) =1.58 as before.
The basis of RMS is that it was originally defined in terms of heating - a
current of Irms will produce the same power in a resistor as a DC current of
the same "magnitude".

--
Don Kelly
dh...@peeshaw.ca
remove the urine to answer


Gareth

unread,
Jul 4, 2002, 6:25:32 PM7/4/02
to
There are actually several different types of average, but when most people
use the word average they are usually talking about the arithmetic mean, I
will assume that is what you refer to here. To calculate the arithmetic
mean, as I am sure you know, you add all the results and divide by the
number of results. For a square wave with 50% duty cycle you would add the
maximum voltage and the minimum voltage. So for a +/- 5V square wave we
have:

(5 + -5)/2 = 0 The arithmetic mean (average) voltage is zero

If we offset by a voltage v_off we have

(5+v_off- 5 + v_off)/2 = v_off

The mean value is equal to the offset voltage.

RMS = Root Mean Square

To calculate the RMS (of anything) you square each result, add them all up,
divide by the number of results, then take the square root. So for our +/-
5 v 50% duty cycle square wave:

5^2 =25 (i)

-5^2 = 25 (ii)

25 + 25 = 50 (iii)

50/2 = 25 this is the Mean Square or MS value (not often used)

RMS = square root of 25 = 5 The RMS value is the peak voltage for a
symmetrical square wave.

You may think that you could just ignore the minus sign but this will not
work if the square wave is offset

To calculate the DC equivalent power think of the power that would be
dissipated if that voltage was connected across a resistor, use a 1 ohm
resistor to make the maths easier.

V=IR

and

P = IV

V = voltage in Volts, I = current in Amps, P = power in Watts

P = V^2/R

So the power dissipated when the voltage is at +5 V = 25/R = 25

The power dissipated when the voltage is at -5 V = 25/R = 25

The mean (average) power is therefore (25 + 25)/2 = 25

Compare these equations with i, ii, iii above, they are the same.

What DC voltage do we need to dissipate 25W in a 1 ohm resistor? 5V. The
RMS is the DC equivalent power for any voltage waveform since the power
dissipated in the resistor is proportional to the voltage squared.


-----------------------------------------------------------------------
To reply to me directly:

Replace the text after the@symbol with: totalise DOT co DOT uk


"Martin Hallett" <mar...@least1.demon.co.uk> wrote in message
news:1025810439.17040....@news.demon.co.uk...

Richard Steven Walz

unread,
Jul 5, 2002, 2:11:36 AM7/5/02
to
In article <1025810439.17040....@news.demon.co.uk>,
----------------------
RMS is the root of the mean of the square: Square the sum (function plus
offset) over(or "times") a repeating period, and then divide by the length of
that period, and then take the square root of that mean. When you square
the function plus offset, you DO need the cross-terms! Example: sine(x) +
offset-constant : Sqr[sine(x)+ OC] = sine^2(x) + 2*OC*sine(x) + (OC)^2 .
Integrate this polynomial over its repeat period (zero to pi) and divide
by the length of the period, pi. Then take the sqr root.

You'll need the Integral of sine squared, and the rest is basic calculus:

http://www.armory.com/~rstevew/Public/Tutor/IntegralSineSqr.txt

A sample RMS calculation is in there too.
-Steve
--
-Steve Walz rst...@armory.com ftp://ftp.armory.com/pub/user/rstevew
Electronics Site!! 1000's of Files and Dirs!! With Schematics Galore!!
http://www.armory.com/~rstevew or http://www.armory.com/~rstevew/Public

Bob Masta

unread,
Jul 5, 2002, 8:54:04 AM7/5/02
to

Not much math needed on this one. The RMS value of a square wave
will be the same as the 0-peak value. (You can think of RMS as the
average of a full-wave-rectified version of the wave. That's not
exactly right for other waveforms, but it is for square waves because
the rectified version is pure DC.) So when you add a DC offset,
the overall RMS is just the sum of the offset value plus the 0-peak
of the square wave. This should seem intuitively correct if you
recall that RMS is the "heating value" of a wave, the value of a
DC voltage that would heat a resistor by the same amount.


Bob Masta
tech(AT)daqarta(DOT)com

D A Q A R T A
Data AcQuisition And Real-Time Analysis
Shareware from Interstellar Research
www.daqarta.com

Ratch

unread,
Jul 5, 2002, 2:15:08 PM7/5/02
to

"Bob Masta" <no_...@aol.com> wrote in message
news:3d2595b3...@news.itd.umich.edu...

> On Thu, 4 Jul 2002 20:20:37 +0100, "Martin Hallett"
> <mar...@least1.demon.co.uk> wrote:
>
> >Hi,
> >Can anyone help me calculate the RMS value for a squarewave which is
offset
> >by some DC voltage? I can understand how you get the average voltage -
> >which seems strange because it seems that the average voltage doesn't
change
> >until the offset is greater than the AC peak value. But, am I right that
> >the RMS value will keep going up from an offset of zero to however far
you
> >want to shift the squarewave?
> >In this case, is it still the RMS that provides the DC equivalent power?
> >Thanks
> >
>
> Not much math needed on this one. The RMS value of a square wave
> will be the same as the 0-peak value. (You can think of RMS as the
> average of a full-wave-rectified version of the wave. That's not
> exactly right for other waveforms, but it is for square waves because
> the rectified version is pure DC.) So when you add a DC offset,
> the overall RMS is just the sum of the offset value plus the 0-peak
> of the square wave. This should seem intuitively correct if you
> recall that RMS is the "heating value" of a wave, the value of a
> DC voltage that would heat a resistor by the same amount.

I am afraid that the intuitive reasoning and answer is wrong. Yes, the
RMS value of a square wave is the same whether it is rectified or not. But
it is not the same when you add a offset to either one. In my previous post
to the questioner, I gave a example of a 3 volt square wave riding on a 4
volt offset. The RMS value is 5 volts. If the square wave was first
rectified to 3 volts DC, then the RMS value would 3+4 = 7 volts. You simply
cannot add the RMS values of the different frequencies together. Each RMS
value from each frequency has to be squared, added together, and then square
rooted to get the total RMS. Ratch

Bob Masta

unread,
Jul 6, 2002, 8:12:00 AM7/6/02
to
On Fri, 05 Jul 2002 18:15:08 GMT, "Ratch" <wa...@attbi.com> wrote:
>
> I am afraid that the intuitive reasoning and answer is wrong. Yes, the
>RMS value of a square wave is the same whether it is rectified or not. But
>it is not the same when you add a offset to either one. In my previous post
>to the questioner, I gave a example of a 3 volt square wave riding on a 4
>volt offset. The RMS value is 5 volts. If the square wave was first
>rectified to 3 volts DC, then the RMS value would 3+4 = 7 volts. You simply
>cannot add the RMS values of the different frequencies together. Each RMS
>value from each frequency has to be squared, added together, and then square
>rooted to get the total RMS. Ratch
>

Sorry, Ratch, but you'd better check your math. Not only
is the intuitive approach easier, but it's less prone to
errors. <g>

Gareth

unread,
Jul 6, 2002, 9:28:23 AM7/6/02
to
Bob,

I have checked Ratch's maths, and I agree with him.

Consider the example Ratch gave of a 3 volt square wave offset by 4 volts.

Vmax = 4 + 3 = 7V

Vmin = 4 - 3 = 1V

Assuming a 50% duty cycle:

(1^2 + 7^2)/2 = 25V = MS voltage

square root of 25 = 5V RMS voltage.

Your approach (or at least my interpretation of your approach) would give
the RMS as 7 V. To me this seems intuitively wrong since you have an RMS
equal to the peak when the voltage is much less than the peak for half the
time.

I think what you have missed in your intuitive approach is that in part of
the cycle the square wave Voltage is subtracted from the offset.

-----------------------------------------------------------------------
To reply to me directly:

Replace the text after the@symbol with: totalise DOT co DOT uk

"Bob Masta" <no_...@aol.com> wrote in message

news:3d26de05...@news.itd.umich.edu...

Gareth

unread,
Jul 6, 2002, 10:20:42 AM7/6/02
to

"Richard Steven Walz" <rst...@deeptht.armory.com> wrote in message
news:3d253898$0$79559>

[SNIP]

>RMS is the root of the mean of the square: Square the sum (function plus
> offset) over(or "times") a repeating period, and then divide by the length
of
> that period, and then take the square root of that mean. When you square
> the function plus offset, you DO need the cross-terms! Example: sine(x) +
> offset-constant : Sqr[sine(x)+ OC] = sine^2(x) + 2*OC*sine(x) + (OC)^2 .
> Integrate this polynomial over its repeat period (zero to pi) and divide
> by the length of the period, pi. Then take the sqr root.

[SNIP]

Steve,

I agree that in general you do need the cross terms, but in many cases (e.g.
50% duty cycle square wave, sine wave) they will cancel for the first and
second half of the cycle.

In the example you give:

sine^2(x) + 2*OC*sine(x) + (OC)^2

The repeat period is 0 to 2pi since you have odd (sine(x)) even (sine(x)^2)
functions, not 0 to pi as you said.

The integral of 2*OC*sine(x) from 0 to 2pi is zero since the first half (0
to pi) will cancel the 2nd half (pi to 2*pi). If you don't believe me
sketch the function and look at the area under the curve.

Bob Masta

unread,
Jul 6, 2002, 1:59:30 PM7/6/02
to
On Sat, 6 Jul 2002 14:28:23 +0100, "Gareth"
<gareth...@nospam.nowhere.invalid.co.uk> wrote:

>Bob,
>
>I have checked Ratch's maths, and I agree with him.
>
>Consider the example Ratch gave of a 3 volt square wave offset by 4 volts.
>
>Vmax = 4 + 3 = 7V
>
>Vmin = 4 - 3 = 1V
>
>Assuming a 50% duty cycle:
>
>(1^2 + 7^2)/2 = 25V = MS voltage
>
>square root of 25 = 5V RMS voltage.
>
>Your approach (or at least my interpretation of your approach) would give
>the RMS as 7 V. To me this seems intuitively wrong since you have an RMS
>equal to the peak when the voltage is much less than the peak for half the
>time.
>
>I think what you have missed in your intuitive approach is that in part of
>the cycle the square wave Voltage is subtracted from the offset.
>
>-----------------------------------------------------------------------

Gareth, Ratch, and all list readers, please accept my
most humble apologies. I not only had a brain-lapse in
the first place, but unpardonably compounded it with
a smart-ass response. I had skimmed through
Ratch's response and seen SQRT(4*4 + 3*3) = 5
and was thinking he was applying the RMS integral
improperly to the levels (and being in a hurry, I didn't
do the math myself), whereas he clearly stated
he was using the frequency component method.

Maybe I should put my brain in gear before
engaging the keyboard.

Now my stupidity and my smart mouth are
(again) imortalized in archives everywhere.

Again, please accept my apologies!

Richard Steven Walz

unread,
Jul 6, 2002, 3:24:10 PM7/6/02
to
In article <ag6uc7$50t$1...@news7.svr.pol.co.uk>,

Gareth <gareth...@nospam.nowhere.invalid.co.uk> wrote:
>
>"Richard Steven Walz" <rst...@deeptht.armory.com> wrote in message
>
>>RMS is the root of the mean of the square: Square the sum (function plus
>> offset) over(or "times") a repeating period, and then divide by the length
>of
>> that period, and then take the square root of that mean. When you square
>> the function plus offset, you DO need the cross-terms! Example: sine(x) +
>> offset-constant : Sqr[sine(x)+ OC] = sine^2(x) + 2*OC*sine(x) + (OC)^2 .
>> Integrate this polynomial over its repeat period (zero to pi) and divide
>> by the length of the period, pi. Then take the sqr root.
>
>Steve,
>
>I agree that in general you do need the cross terms, but in many cases (e.g.
>50% duty cycle square wave, sine wave) they will cancel for the first and
>second half of the cycle.
-------------------------------
Yes, they often fall out. I WAS treating it GENERALLY in case other
questions came up.


>In the example you give:
>
>sine^2(x) + 2*OC*sine(x) + (OC)^2
>
>The repeat period is 0 to 2pi since you have odd (sine(x)) even (sine(x)^2)
>functions, not 0 to pi as you said.

----------------------------
True.


>The integral of 2*OC*sine(x) from 0 to 2pi is zero since the first half (0
>to pi) will cancel the 2nd half (pi to 2*pi). If you don't believe me
>sketch the function and look at the area under the curve.
---------------------

Okay, I just didn't bother.

Ratch

unread,
Jul 6, 2002, 6:13:41 PM7/6/02
to
No offense taken. Ratch

"Bob Masta" <no_...@aol.com> wrote in message

news:3d272d2...@news.itd.umich.edu...

0 new messages