Importance of average

Thread Starter

electronicsLearner77

Joined May 26, 2012
127
In general what is the importance of taking average of a value? Is it always mandatory to take average of any value? The examples i am referring to are like the adc value of some parameters like battery voltage, bateery current etc. Please advise.
 

crutschow

Joined Mar 14, 2008
38,503
It really depends upon parameter and what you are interested in.
If you are not interested in the deviation of the measurements but want the mean value then you take the average of the measurements.
 

GopherT

Joined Nov 23, 2012
8,009
In general what is the importance of taking average of a value? Is it always mandatory to take average of any value? The examples i am referring to are like the adc value of some parameters like battery voltage, bateery current etc. Please advise.
Taking more than one measurement gives you an idea of the stability of the thing you are measuring and/or the stability of your measuring device - calculating a simple average (or other mathematicsl manipulation of your data) puts your answer near the middle of the multiple measurements you took - the goal is to reduce error or get the best possible answer.
 

WBahn

Joined Mar 31, 2012
32,823
In general what is the importance of taking average of a value? Is it always mandatory to take average of any value? The examples i am referring to are like the adc value of some parameters like battery voltage, bateery current etc. Please advise.
As already noted, the importance (if any) depends on what you are trying to accomplish.

If a measurement has any appreciable noise in it, the taking the average over many samples will tend to reduce the noise component and give you a better idea of the "true" value of what you are measuring.

You can also increase the effective resolution of a measurement well beyond the basic physical capabilities of the measuring system this way.
 

Thread Starter

electronicsLearner77

Joined May 26, 2012
127
I have basic confusions on this, if i take the case of any microcontroller based embedded system. Is it assumed that noise will always be present? Whatever i am reading is an invalid value i mean to say it is coming with noise? How many samples i should take? How do i calibrate my system?
 

WBahn

Joined Mar 31, 2012
32,823
I have basic confusions on this, if i take the case of any microcontroller based embedded system. Is it assumed that noise will always be present? Whatever i am reading is an invalid value i mean to say it is coming with noise? How many samples i should take? How do i calibrate my system?
That completely depends on what you are trying to measure -- and in what environment -- and what accuracy/precision you are trying to achieve.

When I worked for NIST we made measurements that were so sensitive that which way you connected the measurement system clips could introduce noise that completely swamped the signal.

One day I was waiting to talk to my project leader and he was busy trying to help someone figure out why they were getting pulsating measurements. The chart recorder pen was moving up and down a couple of inches (when normally the noise was low enough that it moved perhaps a sixteenth of an inch). I was standing about fifteen feet away not paying much attention and I was fiddling with a three foot length of vacuum hose. Suddenly my mind noticed that the sound of the pen carriage was synchronized to the small (several inches) motion I was making with the hose. A few test confirmed that that was the source of the noise.

So what is it that you are tying to do?
 

crutschow

Joined Mar 14, 2008
38,503
Is it assumed that noise will always be present?
Yes.
A certain minimum noise is always present due to thermal (Johnson-Nyquist) noise, possibe electronic shot noise, and quantizing noise in an A/D converter.
On top of that you can have induced noise from EMI or power supply noise, etc.
Whatever i am reading is an invalid value i mean to say it is coming with noise? How many samples i should take? How do i calibrate my system?
You can reduce noise by averaging the samples.
The noise is reduced by the square-root of the number of samples averaged.
How many you need to average depends upon the noise level of the samples and how precise (not its accuracy) you need the measurement.

Calibration is to set the accuracy of the measurement and is different from how noisy or precise the measurement (its resolution).
 

Thread Starter

electronicsLearner77

Joined May 26, 2012
127
The application is vehicle level and the readings are battery voltage and vehicle parameters. Finally i decided to always average of any value i read probably moving average of 10 samples.
 

MrAl

Joined Jun 17, 2014
13,703
The application is vehicle level and the readings are battery voltage and vehicle parameters. Finally i decided to always average of any value i read probably moving average of 10 samples.
Hello there,

In that kind of application averaging is equivalent to low pass filtering.
The advantage of low pass filtering is it can reduce the higher frequency noise which is usually a good thing, at the expense of slower speed of response.
If you take a continuous time low pass filter function and transform it into a discrete time system you get a system that represents an average reading function that can be coded into a microcontroller almost directly.
Because this is also related to statistics, you can also figure out if any of your readings are considered outliers and so can be eliminated entirely.

Just to note, in the past applications i had worked with i had to average over a range of samples from maybe 4 to 64000. So in some cases just 4 but other cases a very large number of samples were required to get just one usable sample.

There are also different implementations. For coding, the most used is probably the "running average". This differs from a normal average but works better because we get an average value for EVERY reading rather than for every 10th reading or whatever.
For a normal average we would sum a bunch of values like say 10 values, then divide by 10. But for a running average we could do this:
Avg=(Avg*(N-1)+Reading)/N

where the current reading is 'Reading' and the Avg is the average, and N is the number of samples we wish to average over.
This means we dont have to keep a large number of readings in store or a large sum.
 
Last edited:
In addition to the excellent suggestions and explanations that you have already received, I would add the following:

Remember, the "average" (arithmetic mean) is a measure of central tendency. That is, given a series of measures (a distribution, if you will), it is one value to describe all of them. There are other measures of central tendency like the mode and median.

The key, in my view, is to look at your distribution - look at the individual measures and note how different they are.

If you are using the mean of a number of samples and noise is present in the samples, then you can gain accuracy by using an average as has been mentioned. The noise, however, ideally would need to be represented on both sides of the distribution and to the same extent (+ and -). If the noise was always additive to the signal, then the mean may not be the best measure of central tendency to reduce the noise.

A moving average could be useful if the signal was expected to be changing over time.

If you had sporadic bursts of noise, you might not want to use a straight mean. You might want to toss very high or very low values and then calculate the mean - if you were sure that these were truly instances where the noise was much greater than the signal, so to speak. You could even use a median.

Again, I think that if you want to use the best measure of central tendency for your application you should look at the distribution of values first.
 

MrAl

Joined Jun 17, 2014
13,703
Just a couple notes...


A moving average could be useful if the signal was expected to be changing over time.
They almost always do in these apps.

If you had sporadic bursts of noise, you might not want to use a straight mean. You might want to toss very high or very low values and then calculate the mean - if you were sure that these were truly instances where the noise was much greater than the signal, so to speak. You could even use a median.
They are called outliers.
See post #9:
"Because this is also related to statistics, you can also figure out if any of your readings are considered outliers and so can be eliminated entirely."
 
Top