# If sampling rate is high does that increase the error or decrease the error?

Suppose we are tracking a computer mouse on the screen, if we increase the frequency of the sampling rate(to very high values) then would that increase the error in getting the exact position of the mouse or decrease it?

Would we get lots of outliers and we would have to average out?

What I am trying to ask will it get smooth lines or every little flicker in movement will be noted?

• +1 While this may sound like novice curiosity, it is indeed a great, deep question. – Dipan Mehta May 24 '12 at 3:58
• The answer to the question in your title is "yes". – Daniel R Hicks May 25 '12 at 0:54

Well, i don't see how is that related to DSP or DIP, except of course the issue of sampling, but here is what is going on:

If you are tracking the mouse by latching on an OS' provided "onMouseMove" signal then you are already enjoying (almost) the maximum sampling resolution offered by the combination of your (hardware + OS). That would be the absolute max in Fs accessible by other programs running on the system.

Is that enough? It is, if you are free drawing with small movements trying to get the contour of an object in some photo editing software (for example). But if you click on the mouse and go crazy with it you might start to notice the trick behind the "smooth lines" which is to compose them of linear segments. Therefore, because of the large actual movement compared to the Fs you will start noticing some long lines appearing as the linear segments connect points that are far appart.

Can this Fs be changed? (Increased / Decreased) Yes, it probably can but that would depend on your hardware + software combination. For example, here are a few pieces of information regarding the PS2 mice where you can see a specific command that can be sent to it to change the sampling resolution (search for "set mouse sample rate"). How you actually get to send this command to the mouse so that the sample rate is changed across the system, depends on your OS).

Will higher Fs lead to improved tracking of the actual mouse movement (smaller error)? Yes, that is the point of increasing the Fs, you can track the continuous physical phenomenon much better.

Why don't we crank the Fs up all the way then? Because depending on your Hardware + OS there will be a limit that you can increase the Fs before it starts becoming "noticable" by your system. What you want to avoid is having the OS triggering the "onMouseMove" signal / message so fast that it floods the message queue and at the extremes the system ends up absorbed to serving just this kind of requests.

Similarly, if you are tracking the mouse position with any other means (a camera looking at the screen for "an arrow that points up left" for example, or the same thing by screen grabbing) and possibly with another $Fs_{Track} < Fs_{Sys}$ then the same thing applies. However, in this case, MAYBE you can somehow increase $Fs_{Track}$ by improving the scanning process...but the best case scenario is that you will be approaching $Fs_{Sys}$ not exceeding it.

I hope this helps.

P.S. Regarding "every flicker", modern mice will report a resolution in DPI (Older mice had mechanical rotary encoders and just good enough resolution). Therefore, you can consider your mouse reporting its position over a very fine canvas. In general, mice are good in discriminating movement and will report robust positions over this fine canvas. There are exceptions however where an optical mouse, at rest, will report changes in the position depending on the surface it rests on. In this case, the mouse gets "tricked" and you can avoid this flicker by changing the mat it rests on. For any other means of tracking, the "flicker" will depend on the tracker and Signal to Noise Ratio (SNR).

• +1. It sounds like the linear interpolation becomes more noticeable once the movement frequency goes beyond Nyquist. – Jim Clay May 24 '12 at 12:41

Both, depending on how you measure error.

If the average error of each sample was, say +-1, then more and more samples will give you more and more of these off-by-one points in total. The sum of the absolute unweighted errors would increase. However, the law of large numbers suggests that an average of all these errors might get closer and closer to zero. So if you smooth the plotted line by some kind of averaging or regression fit, more points might get you a closer estimate to the actual position. But if, instead of averaging, you plot each individual point, then the fractal length of the plot line could head off to infinity as you add more and more plot points, each with their own individual errors. The estimate of the distance that the mouse travels could get worse with more points or less points per unit time than some optimal value.

• Re the general question of signal sampling rate (not necessarily applicable to the mouse situation), there is a problem that the faster you sample the fewer electrons you count in each sample. Sampling slowly you count a lot of electrons, so a few electrons more or less will not affect the measurement much. Sample more rapidly, though, and an effect similar to Brownian motion begins to intrude, and the numerical error in each sample can become much larger. – Daniel R Hicks May 27 '12 at 11:36