# Math Help - RMS for a Square Wave Signal?

1. ## RMS for a Square Wave Signal?

Hey everyone, I'm trying to learn how to manually do RMS calculation for Square Wave Signals. I've read the following in several places:

* Some say that for a Square wave, RMS = Peak but I believe they all assume that the signal is uniform with its centre at the origin.

* RMS = Peak / $\sqrt{2}$ , but I thought that was for sinusoidal waveforms.

Anyways, here is an example:

Notice how this square wave form is considerably off centre from the x axis, meaning the majority of the waveform is above the x-axis.

How do I calculate the RMS value?

Thank you - Samson

2. ## Re: RMS for a Square Wave Signal?

Hi Samson!

The RMS value is the "root mean squared" value.
To calculate it, you need to calculate the squares of your signal, average them (weighted), and take the square root.

Btw, as far as I can tell the wave form is symmetric around the x-axis.

3. ## Re: RMS for a Square Wave Signal?

Originally Posted by ILikeSerena
Hi Samson!

The RMS value is the "root mean squared" value.
To calculate it, you need to calculate the squares of your signal, average them (weighted), and take the square root.

Btw, as far as I can tell the wave form is symmetric around the x-axis.
Hello Serena,

So how do I calculate the squares of my square wave signal and average them? You also noted weighted, what do you mean?

On that figure above, I don't see how I can square it and average them when I don't have that detailed of an interval. I guess I could use the interval from 10 ms to 20 ms and just correlate the same region (1V) ?

4. ## Re: RMS for a Square Wave Signal?

Usually we look at one period of a wave.
Your wave is at -1 V for the first 2 ms.
Then +1 V for 2 ms.

The following table shows the amplitudes and the squared amplitudes that you have in your wave, combined with the duration of each amplitude.
From it we can calculate the average of the squared amplitudes.
$\begin{array}{|c|c|c|}\hline \textbf{duration} & \textbf{amplitude} & \textbf{squared}\\ \hline 2 ms & -1 V & 1 V^2\\ 2 ms & +1 V & 1 V^2 \\ 2 & 2 & 4 \\ 2 & 1 & 1 \\ 2 & -1 & 1 \\ 2 & -2 & 4 \\ \hline \end{array}$

The average of the squares is ${1+1+4+1+1+4 \over 6} = 2 V^2$.
The RMS is the square root, which is $\sqrt{2} V$.

In this case all durations are the same.
If they are not then the squares have to be "weighed" by the duration.

In total the squared signal is $1 V^2$ for a period of 8 ms, and $4 V^2$ for a period of 4 ms.
The weighed average is ${8 \times 1 + 4 \times 4 \over 8 + 4} = 2 V^2$.
As you can see this matches with the mean square that I found earlier.

5. ## Re: RMS for a Square Wave Signal?

Wow! Thank you! So how could you tell that they were 2ms intervals? I had trouble because of where they put the 10, or was that a very good assumption?

Two other quick questions:
1. How would this differ if the whole signal was shifted up one unit?
2. It would have been incorrect to just look at the peak value of this signal being 2 and dividing it by $\sqrt{2}$ to reveal an RMS value of $\sqrt{2}$ right?

Thank you!

6. ## Re: RMS for a Square Wave Signal?

Originally Posted by Samson
Wow! Thank you! So how could you tell that they were 2ms intervals? I had trouble because of where they put the 10, or was that a very good assumption?

Two other quick questions:
1. How would this differ if the whole signal was shifted up one unit?
2. It would have been incorrect to just look at the peak value of this signal being 2 and dividing it by $\sqrt{2}$ to reveal an RMS value of $\sqrt{2}$ right?

Thank you!
Now that you mention it, I'm not sure why I thought why each piece was 2 ms.
Looking again it looks closer to 3 ms.
Luckily it does not matter for the calculation whether the pieces are 2 ms or 3 ms.
As long as they have the same duration.

It the signal is shifted up by 1 V, the squares change, and the resulting RMS value will be higher.

And yes, you can't just look at the peak and divide by $\sqrt{2}$.
It depends on the shape of the signal what the RMS value is.
For a sine wave, the RMS is the amplitude divided by $\sqrt{2}$, but for a square wave, it is simply its amplitude.

7. ## Re: RMS for a Square Wave Signal?

Originally Posted by ILikeSerena
Now that you mention it, I'm not sure why I thought why each piece was 2 ms.
Looking again it looks closer to 3 ms.
Luckily it does not matter for the calculation whether the pieces are 2 ms or 3 ms.
As long as they have the same duration.

It the signal is shifted up by 1 V, the squares change, and the resulting RMS value will be higher.

And yes, you can't just look at the peak and divide by $\sqrt{2}$.
It depends on the shape of the signal what the RMS value is.
For a sine wave, the RMS is the amplitude divided by $\sqrt{2}$, but for a square wave, it is simply its amplitude.
So you're saying that the 2ms or 3ms doesn't matter as long as you're using a consistent unit of measure for the intervals then, correct?

Also, when you said the RMS for a square wave is simply its amplitude, you mean like a standard square wave that is rather binary (high/low), correct? The square wave in the above example is different then, correct?

What if the signal is a sine wave and it has a vertical axis offset, i.e. $y(x) = Sin(x) + 1$, is the RMS of the signal in that case $\sqrt{2}$ since the peak of the Sin wave is 1 and its being bumped up 1 due to the offset?

Thank you!

8. ## Re: RMS for a Square Wave Signal?

Yes, with a consistent unit of measure you will get the same result.

Yes, I meant a square wave that is half of its time positive, and the other half equally negative.

sin(x) has RMS = $\sqrt{1 \over 2} = {1 \over \sqrt 2}$.

1+sin(x) has RMS = $\sqrt {3 \over 2}$. As you can see, this is not simply bumped up by 1.

9. ## Re: RMS for a Square Wave Signal?

Thank you so much for your help!