RMS Voltage for a Triangular waveform

someonesdad

Joined Jul 7, 2009
1,583
If a numerical result is suitable, here's a python script that will calculate the RMS value of a waveform. You need the matplotlib and numpy libraries; they can be gotten from the SciPy website.

Rich (BB code):
from pylab import *

dist, numpoints = 1.0, 100
x = arange(0, dist, dist/numpoints)
ypos, yneg = x, -x + 1
x = arange(0, 4*dist, dist/numpoints)
y = concatenate((ypos, yneg, yneg - 1, ypos - 1))

rms = sqrt(average(y*y))

plot(x, y)
title("RMS value of a triangle wave")
text(2.5, 0.7, "RMS = %.3g" % rms, fontsize=20)
grid(True)
show()
It produced the attached graph. It goes without saying that the method can calculate the RMS value of any waveform that you can write down a formula for. Of course, since it is using a sampled waveform, you'd want to increase the number of points to make sure you weren't seeing quantization errors.

It's also a short step to using something like SciPy's Romberg integration routine to do a numerical integration of the function using the definition of the RMS value. This would be a more efficient way to get a high precision answer. But for most engineering problems, 2 or 3 significant figures are fine and are most easily gotten by the first approach.
 

Attachments

Top