Register to reply 
RMS of Fundamental Component 
Share this thread: 
#1
Jul614, 03:25 PM

P: 1,089

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?



#2
Jul614, 07:47 PM

HW Helper
Thanks
P: 5,152

Are you wanting to perform the task in software or as a hardware implementation? 


#3
Jul614, 08:43 PM

P: 1,089

Any ideas? 


#4
Jul614, 11:05 PM

HW Helper
Thanks
P: 5,152

RMS of Fundamental Component
You have no prior knowledge whether the cyclic period extends for some days, hours, or just milliseconds?? Your software will first have to establish this, undoubtedly. What is the source of such a signal? 


#5
Jul714, 08:06 AM

P: 1,089

Look forward to your thoughts. 


#6
Jul714, 08:52 AM

P: 171

But the RMS value is only defined for an integer number of whole cycles. If the period of the waveform you're measuring is longer than 50μs, then your goals are contradictory.
My suggestion to redefine "real time" to mean something longer than one complete cycle of the waveform, and calculate RMS at that interval. You could define a rolling mean with a buffer big enough to hold one cycle's worth of samples. With each new sample,drop the oldest and add the newest. But if you did that, the definition of what your measurement means would be squishy and not worth the trouble. Your real problem is a bogus definition of "real time" Oh yes, you said fundamental component too. To do that you need to use a low pass filter on the samples before calculating the RMS. The filter will add some phase shift (time delay) that could be large compared to 50μs, further clouding what a "real time" RMS at 50μs intervals would mean. 


#7
Jul714, 09:56 AM

HW Helper
Thanks
P: 5,152

It's probably going to become relevant to your considerations: approximately what per cent of the total power is contained in the fundamental? 


#8
Jul714, 09:57 AM

P: 2,499

There is a bit of confusion here. RMS means the Root of the Mean of the Square(s). Since the word "Mean" is included it implies storing a number of samples to later be averaged. With a sine wave this is only necessary for one cycle. But it is implied in post #5 that the signal can suddenly change. So this means storing for longer. How is 'real time' to be defined? The OP hasn't said just what type of results are expected. Generally one has expectations of what the results will be before attempting to measure. Technically, "realtime" would not be averaged in any way. An analog scope displays voltage in realtime and the result is a graph.



#9
Jul714, 11:02 AM

Sci Advisor
PF Gold
P: 11,925

If you want to do a good 'running' frequency analysis of your signal then you will need a long sequence of samples, suitably windowed or you could end up with some embarrassing artefacts  I could imagine two possible 'fundamentals' could emerge, for instance. How many sample intervals can you afford to wait before the analysis and what sort of frequency range are you expecting for the input waveform?



#10
Jul714, 12:28 PM

P: 1,089

Assume that we know beforehand that the fundamental of this input signal equivalent to, [tex]M_{1}sin(1t)[/tex] Then we expect the output (i.e. the RMS of the fundamental component) to be, [tex]\frac{M_{1}}{\sqrt{2}}[/tex] Now if the input signal were to suddenly change such that the fundamental of this altered input signal is equivalent to, [tex]M_{2}sin(1t)[/tex] Then we expect the output (i.e. the RMS of the fundamental component) to be, [tex]\frac{M_{2}}{\sqrt{2}}[/tex] and so on for any arbitrary periodic input. I would like to have my output transition from say, [tex]\frac{M_{1}}{2}[/tex] to, [tex]\frac{M_{2}}{2}[/tex] as quickly as possible. Is it more clear what I am trying to achieve? 


#11
Jul714, 12:56 PM

P: 171

A sudden jump from M1 to M2 makes the signal nonsinusoidal which conflicts with your assumptions. Rootmeansquare only has meaning for whole cycles, it has no instantaneous meaning.
If you report a change in RMS because just one sample deviated, then you may falsely report a momentary spike as representing a whole cycle's change in RMS value. In other words, reporting RMS measurements the way you propose will amplify noise. If you filter the data to only fundamental frequency, then the momentary spike will be eliminated from the data and there will be no change to report after the first sample. If the change is not a momentary spike, but rather a sustained change, then you must gather many samples from one or several whole cycles before jumping to the conclusion that the change should be reported. That means delaying the measurement until you are sure it's valid. The problem is not with algorithm, it is with your requirements. 


#12
Jul714, 01:07 PM

P: 1,089




#13
Jul714, 01:22 PM

Sci Advisor
PF Gold
P: 11,925

I think the reaction against your idea of "real time" requirement is a bit nit picking. It seems reasonable enough to me if you can accept some delay. Every measurement takes some time  there is always some builtin delay. I suspect you really mean a continuous series of measurements, rather than 'batch processing. The delay that is involved will depend upon several factors  including the ones already mentioned, like number of cycles involved in the processing and the nature of the waveform. 


#14
Jul714, 11:47 PM

HW Helper
Thanks
P: 5,152

If you know ahead of time the frequency of the fundamental and it's fixed for each source, the simplest solution would be to pass the signal through an analog LPF specific to that source and connect the filter's (sinewave) output directly to a voltmeter. Maybe use capacitive coupling to the filter to remove any DC component.
I'm curious to learn why you wish to disregard the power in the harmonic content? Also, is there likely to be appreciable noise on the signal? Should this be allowed for? 


#15
Jul814, 03:51 AM

Sci Advisor
PF Gold
P: 11,925

You're certainly right that noise could be a fresh can of worms and increase the processing time significantly.



#16
Jul814, 06:41 AM

P: 171

Here is the original question.
Why don't you start again from scratch? Tell in more detail what you do know about the frequency range and noise in the signal and what you hope to accomplish in terms of frequency of RMS calculations and tolerance for noise. If it is 100% unknown, then there is no answer. Then try to state your question more clearly. What do you expect from this forum short of the code? 


#17
Jul814, 03:45 PM

P: 1,089

Does assuming the fundamental frequency is within the range 0Hz < f < 1000Hz simplify the problem at all? 


#18
Jul814, 04:14 PM

Sci Advisor
PF Gold
P: 11,925

I have a feeling that you need to get a bit more familiar with the basics of this stuff before you launch out on this exercise. Any routine you write could well yield some numerical values but they would have no meaning  or at least the numbers would need to be interpreted carefully because they cannot be a true 'RMS of a fundamental'. You say you want your routine to work on a perfectly 'general' set of signals. What sort of interpretation would you expect if your particular signal consisted of the sum of two sine waves, of equal amplitude and different frequencies? What if your signal was part of a low pass filtered long pseudorandom sequence? What would be the fundamental frequency of that? (Answer = 1/(total repeat length of the sequence) It just ain't that simple, you see. (Unless you are prepared to be much more specific about the actual nature of your signal). 


Register to reply 
Related Discussions  
Finding the angle given positive x component and negative y component  Introductory Physics Homework  5  
Splitting a vector into a rowspace component and a nullspace component  Calculus & Beyond Homework  2  
Proving covariant component is physical component times scaling factor  Calculus & Beyond Homework  1  
Any notation for componentbycomponent vector multiplication?  General Math  12  
Splitting wave equation into xcomponent and ycomponent  Classical Physics  16 