# How could I measure noise of gyroscope angle readings?

I have a system that uses gyroscopes to ultimately give me the angles/orientation of an object. So, let's say that the object is sitting at 90 degrees. I might get some readings such as:

87.56632 deg
87.25641 deg
87.69428 deg


Let's say I get roughly 100 values, I know that the in a perfect world the gyroscope would give me 90 degrees. Well, since we are not in a perfect world I get values like those shown above.

Let's say that the values are not perfect due to some noise in the system. Is there some mathematical formulas that I can use to get an idea of relatively "how noisy" my data-set happens to be (purely from a fixed sample size of only the angles)?

In other words, what I am trying to do here is:

Get an idea of how noisy the data is bouncing around, with respect to the value I know it should be (exactly 90 degrees).

• At a certain point it is not only noise, but actual movement/vibration, e.g. caused by a truck driving outside. Sep 8 '16 at 15:22
• @PlasmaHH Sure. Maybe I shouldn't have called it "noise" but what I mean is... "anything that makes my number not perfect" Sep 8 '16 at 15:23
• Those deviations are part of a perfect number, since its the instrument performing how it should: it moves a tiny bit, so the number changes. Calculate for your device how much you have to move one corner (theoretically) to have it change the output by the least significant digit. You will be surprised. Sep 8 '16 at 15:25
• I'd like to get an idea of whether the data is "very noisy" or "not that noisy". Sep 8 '16 at 15:26
• @PlasmaHH The variance is totally acceptable, due to the outside influences on the system (like those you've described). Sep 8 '16 at 15:27

You seem to be talking about standard deviation. It is a widely used measure of quality for repetitive measurements, calculated with the following formula: $$\sigma=\sqrt{\frac1 N\Sigma(x_i-\mu)^2} ,\ where\ \mu=\frac1 N\Sigma x_i$$

For a known $\sigma$ you can expect 99% of your measurements to be within [+3$\sigma$; -3$\sigma$] interval. If your application must distinguish between values which are within 3$\sigma$ from each other or less, then your measurements are too noisy and you may need a more precise sensor or some sort of noise cancellation algorithm. Otherwise, your measurements are probably fine.

PS. Since your measurements don't give you 90 on average, you probably didn't calibrate your sensor, so you also have an offset error.

• This could work for what I am trying to do, I will just wait and see if there are any known methods of analyzing the noise of the gyro angles directly. Sep 8 '16 at 15:46
• @StevieV: Do you not know how to take the mean and standard deviation of a set of numbers? You can, for example, plug them into pretty much any spreadsheet program. Sep 8 '16 at 15:51
• @DaveTweed I know how to do all of that, why do you ask? Sep 8 '16 at 15:56
• Because your comment implied that you didn't understand how the answer applies to your situation. Just compute the mean and standard deviation of the sequence of numbers that the gyro is producing. What else do you want to know? Sep 8 '16 at 16:01
• @StevieV Unless you know that your sensor's error distribution is different from normal, standard deviation is the best error estimate you can get. Sep 8 '16 at 16:08

What you seem to be asking about is to determine the AC component that is on top of the DC average. There are various ways algorithmically to do this.

The conceptually obvious way is to find the DC average, subtract that from every value, then find the RMS of the result. Algorithmically it may be simpler to compute the average and RMS together, then subtract the two to get some measure of the AC component.

For example, let's say we have samples 8, 9, 9, 10, 11, 11, 12. The average is obviously 10. The AC component is then -2, -1, -1, 0, 1, 1, 2. The RMS of that is 1.31.

To compute the RMS, square all the values:
4, 1, 1, 0, 1, 1, 4
Then find the average of these. That's the total divided by the number of values. 12 / 7 = 1.714. The square root of that is the RMS value. Sqrt(1.714) = 1.31.

Now taking the same samples and computing the RMS directly yields 10.09. The difference from that to the average is 0.09. This isn't the RMS (it's actually related to the standard deviation) of the AC component, but can still be useful measure of "how much the signal is bouncing around".

• I did the RMS of (-2, -1, -1, 0, 1, 1, 2) and I am getting 1.309. Isn't the RMS just the square root of the mean of the X^2 values? How are you getting 0.86? Sep 8 '16 at 16:58
• @Stevie: I have no idea where 0.86 came from, probably a typo punching something into the calculator. I fixed it and showed explicitly how the RMS value is calculated. Thanks for catching that. Sep 8 '16 at 17:05