RMS of Fundamental Component

Thread Starter

jegues

Joined Sep 13, 2010
733
Every 50μs I have access to one sample of an unknown peroidic input signal and I am looking to calculate the RMS of the fundamental component. Is there any convenient ways one can think of doing this?
 

Papabravo

Joined Feb 24, 2006
21,228
Just based on the information you have given I would say no. You cannot determine the frequency of the fundamental component. You did not say the input signal was band-limited by an anti-aliasing filter so you're just SOL.
 

Lestraveled

Joined May 19, 2014
1,946
If you assume random sampling, the more samples you take the more accurate your RMS calculation becomes over time. You can use delta RMS per unit time to determine accuracy. Of course this only works with non varying amplitudes.......I think.
 

Papabravo

Joined Feb 24, 2006
21,228
The RMS calculation requires that you square the waveform, take the mean over one period, and take the square root of that. You can have a varying amplitude but you must know the length of a period.
 

Thread Starter

jegues

Joined Sep 13, 2010
733
Just based on the information you have given I would say no. You cannot determine the frequency of the fundamental component. You did not say the input signal was band-limited by an anti-aliasing filter so you're just SOL.
So if the user specified the frequency of the unknown periodic waveform, would this be possible? Is this specified frequency the same as the frequency of the fundamental component?
 

Papabravo

Joined Feb 24, 2006
21,228
So if the user specified the frequency of the unknown periodic waveform, would this be possible? Is this specified frequency the same as the frequency of the fundamental component?
If you know the frequency of the fundamental component you have a shot. You also have to be careful that high frequencies don't alias for lower frequencies. That is why you need an analog anti-aliasing filter ahead of ANY digital process you plan to apply.
 

Lestraveled

Joined May 19, 2014
1,946
There is not a frequency term in the RMS formula. If you need one, make it scalar based on the number of samples and the sample interval.
 

NorthGuy

Joined Jun 28, 2014
611
There is not a frequency term in the RMS formula.
But frequency is important nonetheless. For example, if the signal frequency is 60Hz and your sampling frequency is 60Hz too, you'll be sampling all peaks (and overestimate RMS) or all zeroes (and underestimate). There are other frequency effects too.

Therefore, if you wat to measure RMS you need to choose your sampling frequency carefully, so that you don't get in troubles for your expected signal frequency range.
 

Lestraveled

Joined May 19, 2014
1,946
Northguy
What you are describing only occurs when the sample rate and the frequency of the unknown signal are coherent (phase locked). The OP indicated that this is not the case. If I sample a 60 Hz sine wave at a 60 Hz rate I will eventually get enough samples to accurately describe its RMS value if, and only if, the two clocks are not coherent. The time period in this case is the reciprocal of the difference in their frequency. For instance: 60.000 Hz minus 60.001 Hz = .001HZ or 1000 seconds.
 

MrChips

Joined Oct 2, 2009
30,824
It really depends on your exact situation and what you are trying to achieve.

Trying to measure the amplitude of AC mains voltage is quite different from measuring an arbitrary sine wave signal buried in noise.

If the situation is the latter case and you know the frequency of the signal, I would acquire at minimum, 10 samples per period. 20-100 samples would be even better.

There are linear least squares algorithms at will allow you to extract amplitude, frequency, phase and DC offset of the signal buried in noise.
 

shteii01

Joined Feb 19, 2010
4,644
50 us. That be sampling frequency of 20 kHz. You can use that to sample signals that have frequencies from 0-10 kHz.

Collect the samples. From them determine the frequency of the signal (or ask the signal generator to tell you what the frequency is ahead of time). Then do the math.
 

NorthGuy

Joined Jun 28, 2014
611
What you are describing only occurs when the sample rate and the frequency of the unknown signal are coherent (phase locked). The OP indicated that this is not the case. If I sample a 60 Hz sine wave at a 60 Hz rate I will eventually get enough samples to accurately describe its RMS value if, and only if, the two clocks are not coherent. The time period in this case is the reciprocal of the difference in their frequency. For instance: 60.000 Hz minus 60.001 Hz = .001HZ or 1000 seconds.
Right. And if you sample this for 1000 seconds, the result will be different than if you sample it for 1500 seconds.

The errors will happen if your sampling frequency coinsides with any of the harmonics of the signal frequency. To avoid such effects you will have to employ a low-pass filter as Papabravo said. As a result of the filtering, you will only get good results only if signal frequency is substantially less than your sampling frequency.

You will also get in troubles if you try to measure the signal frequency which is too low. Say, if you take 100 consecutive samples at 1MHz to measue RMS of 60Hz signal, the result will be pretty much random.

Therefore, you cannot use fixed sampling frequency and pre-determined number of samples to effectively measure RMS for all possible frequencies of the signal.
 

Lestraveled

Joined May 19, 2014
1,946
NorthGuy
Lets look at from a different point of view. Suppose the signal being sampled was Gaussian noise. The longer you sample, the more accurately you can approximate what the RMS value is.

Any agreement?

Also, I do realize I was "off track" because the OP was asking to measure the fundamental amplitude not full spectrum.

Mark
 

NorthGuy

Joined Jun 28, 2014
611
Lets look at from a different point of view. Suppose the signal being sampled was Gaussian noise. The longer you sample, the more accurately you can approximate what the RMS value is.

Any agreement?
No doubts. This is becuase errors are independent and autocorrelations are zero.
 

Lestraveled

Joined May 19, 2014
1,946
NorthGuy
Then I don't understand why you can't take the same approach with an unknown signal? Use the delta RMS as your indication of when you have taken enough samples.

Mark
 
Top