# RMS Voltage for a Triangular waveform

Discussion in 'Homework Help' started by Larry Makanza, Nov 19, 2010.

1. ### Larry Makanza Thread Starter New Member

Nov 19, 2010
3
0
Is there a standard formula for calculating the RMS value of a triangular waveform?

Apr 5, 2008
17,137
3,009

Jul 7, 2009
1,585
141
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.

Code ( (Unknown Language)):
1.
2. from pylab import *
3.
4. dist, numpoints = 1.0, 100
5. x = arange(0, dist, dist/numpoints)
6. ypos, yneg = x, -x + 1
7. x = arange(0, 4*dist, dist/numpoints)
8. y = concatenate((ypos, yneg, yneg - 1, ypos - 1))
9.
10. rms = sqrt(average(y*y))
11.
12. plot(x, y)
13. title("RMS value of a triangle wave")
14. text(2.5, 0.7, "RMS = %.3g" % rms, fontsize=20)
15. grid(True)
16. show()
17.
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.

File size:
25.7 KB
Views:
90
4. ### Larry Makanza Thread Starter New Member

Nov 19, 2010
3
0
Just want to say thanks to Bertus and Someonesdad for your replies. It was a great help.

Larry Makanza