CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

AD Digital Filter
Goto page Previous  1, 2, 3, 4, 5
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Fri May 02, 2014 2:14 pm     Reply with quote

Sorry newguy. I disagree.

My method computes R.M.S. values for ANY waveform, bipolar, uni-polar or any anything in-between.
It is a bog standard algorithm which worked over half a century ago when I studied statistics. I don't see why it should not work now.

The real beauty; it is a single pass process, any offset falls out at the end.

Mike
newguy



Joined: 24 Jun 2004
Posts: 1938

View user's profile Send private message

PostPosted: Fri May 02, 2014 2:46 pm     Reply with quote

I put together a spreadsheet with a sinusoidal waveform and added random noise. Computed RMS the traditional way and your way and the values agreed closely.

I then added a DC offset to the sinusoid and the two methods suddenly no longer agreed. The greater the offset, the higher the difference.

For example:
- create a spreadsheet with 500 samples, 0-499
- omega column = 2*pi()*sample/500
- sample noisy waveform = 18.3 + 5.15*sin(omega)+(3.52*(rand() - .5)))

Using the traditional method of calculating RMS value, I get 18.702. The magic number method gives me 3.821. If I make the offset term 0, the traditional RMS value is 3.832 and the magic number method gives 3.850.

My original assertion stands: this method doesn't take DC offsets into account properly.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sat May 03, 2014 1:53 am     Reply with quote

First thoughts.

You're testing with a sine-wave of amplitude 5.15.
Whichever method you use, the RMS value of the pure waveform should be 5.15/(2^0.5)
That's ~3.64.
My method gives the RMS value of the AC component of the waveform and ignores the DC offset, which is what the O/P appeared to want.

With noise you will get higher values.

I'll do a repeat of your noisy spread sheet analysis and come back.

Mike
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sat May 03, 2014 3:50 am     Reply with quote

OK. I've done a spreadsheet analysis on noisy sine-waves with Excel.

I performed the calculations on 1000 values for one cycle of the sine-wave.
I varied the sine-wave & noise amplitudes, and the offset

Each time F9 is pressed, Excel generates a new set of random Nos and new RMS values.
I calculated by both the traditional and the faster method on the each set of values.
Both methods produced exactly the same RMS value on each iteration (within Excel's limitations).

Mike
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5
Page 5 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group