From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get RMS of triangle wave

Solved!
Go to solution

The image you posted of your data looks suspiciously like it is seriously undersampled.  It is definitely not a triangle wave.  The plot just draws straight lines between data points, making the image look "pointy."  Does this data make any sense when compared to what you expect the signal source to generate?

 

Try sampling 10 or 100 times faster to see what the waveform looks like.

 

Any calculations you do on this data are likely to be rather meaningless if it is sampled at less that the Nyquist rate.

 

Lynn

0 Kudos
Message 11 of 22
(7,954 Views)

Johnsold is right.

Assuming your main signal frequence is line freq. (50/60Hz) you should at least measure with 2kHz better 10kHz to make a reasonable 'True' RMS measurement.

Make a measurement with the highest possible samplerate (250kHz?) and have a look at your signal (or use a scope) . Even better : Make that reading and take a look at the  FFT power spectrum of that waveform. All that points different from zero in the power spectrum diagram represent energie for your RMS value. Most propably the main content is in the lower range and multiple of the line freq. (And post that diagram 😉 )

You might find an example in the provided examples where all this is already done....

 

EDIT: And capture 5 to 10 periodes ....

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 12 of 22
(7,947 Views)

Hi Jill, thanks for your input.  The image I posted was sampled at 500us.  By separating the cycles, taking the peak of each cycle, then averaging the peaks and dividing by sq.rt(3) I get my expected voltage.  Now I'm confused, how is this possible if it is not a triangle wave?  I sampled the signal again at 1us which can be seen in the attached photo.  Unfortunately, I cannot sample any faster using my cRIO. 

0 Kudos
Message 13 of 22
(7,936 Views)

 


@phdieum wrote:

Hi Jill, thanks for your input.  The image I posted was sampled at 500us.  By separating the cycles, taking the peak of each cycle, then averaging the peaks and dividing by sq.rt(3) I get my expected voltage.  Now I'm confused, how is this possible if it is not a triangle wave?  I sampled the signal again at 1us which can be seen in the attached photo.  Unfortunately, I cannot sample any faster using my cRIO. 

 


OK your math is a bit funny.  I don't follow the Vpk *1/3^-2  This would estimate a Veff of a sine wave.

 

Vrms is the area under the waveform

 

For a pure sine wave Vrms = 0.658 Vpk and Veff = .707 Vpk

For a pure square wave Vrms = Vpk

For a pure Triangle wave Vrms = 0.5Vpk


"Should be" isn't "Is" -Jay
0 Kudos
Message 14 of 22
(7,922 Views)

The RMS value for a triangle wave (or sawtooth) is Vpk/sqrt(3).  For symmetric waveforms like those you only need to integrate over a quarter period to verify (or use the LV functions).  At any rate, by inspection it must be less than the sinusoid Vpk/sqrt(2).

 

How well this simple estimate matches the calculated value depends on the input (1) being triangular or sawtooth (2) having zero dc offset (3) being sufficiently sampled so that the simple numerical integration is accurate and (4) having a sample period equal to an integer number of full periods of the squared waveform.

0 Kudos
Message 15 of 22
(7,913 Views)
Solution
Accepted by topic author phdieum

OK.  Forget rms and simple formulas.  The graph image you posted sampled at 500 us shows that your signal is quite noisy and not clearly either a sine or triangle as the underlying structure.  It appears that the noise peak to peak amplitude is about 1/4 of the signal peak to peak amplitude at best.

 

Let's go back to the beginning.

1. What is the source of this signal?

2. What is the source or sources of the noise?

3. How do the frequency and amplitude of signal and noise vary?

4. What are your going to do with the data when you get it? Or, Why do you think rms is the appropriate measurement technique for what you are doing?

5. Do you have other knowledge which can help analyze the signal, such as a clean synchronizing signal?

 

Lynn

0 Kudos
Message 16 of 22
(7,902 Views)

EDIT=  double checking my math


"Should be" isn't "Is" -Jay
0 Kudos
Message 17 of 22
(7,900 Views)

Yup For a sine wave

But sin2ωt + cos2ωt = 1. Therefore the average values of either of them must be 1/2.
 
Therefore the rms value of Iosinωt must be Io /√ 2

 

for a Triangle (AC, with 0 DC offset) A =1/2(H*B).  Integrate over B = 1/2 Vpk. 

 

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 18 of 22
(7,893 Views)

If you do not believe me, do you believe G?

 

RMS.png

 

Keep in mind that the mean of the square is typically not the square of the mean so the RMS is not equivalent to the area.

Message 19 of 22
(7,891 Views)

@phdieum wrote:

Hi Jill, thanks for your input.  The image I posted was sampled at 500us.  By separating the cycles, taking the peak of each cycle, then averaging the peaks and dividing by sq.rt(3) I get my expected voltage.  Now I'm confused, how is this possible if it is not a triangle wave?  I sampled the signal again at 1us which can be seen in the attached photo.  Unfortunately, I cannot sample any faster using my cRIO. 

 


If you are using a 9206 the max samplerate is 250kS/s (4µ) or did you use another card? 

Do you have access to a scope? If you don't know your signal all will be just guessing ( And don't trust the Klein CL2000 DMM , it's only valid for frequencies up to 400Hz )

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 20 of 22
(7,875 Views)