
#1
Nov2012, 11:42 PM

P: 443

I don't have a ton of experience in numerical methods, so I'm hoping someone can help me out. Suppose I have a sequence of position data points for a car, but they've been truncated to integer values. I want to find the speed (derivative), but for speeds which are low relative to the time between measurements, I find that repeated measurements kill my evaluation of the derivative. For example, if the actual position sequence of the car was {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}, it would be measured as {0, 0, 0, 0, 1, 1, 1, 1, 1}. So if I apply a simple difference operator, instead of getting a constant speed like the actual position sequence implies, I would be getting mostly zero speed with a sudden spike at the point where the measured position changes from 0 to 1.
So my question is, how do I properly differentiate data that looks truncated or stepped like this? (noting that I need to be able to do it in real time, i.e. without using any future data points) I've tried a few different things, but have only had marginal success. Any suggestions would be greatly appreciated. 



#2
Nov2112, 01:01 AM

Homework
Sci Advisor
HW Helper
Thanks ∞
P: 9,215

You need a mathematical model (based on physical considerations) for what the underlying data might look like. The simplest would be constant speed, next a constant accn, etc. The number of parameters should be rather less than the number of datapoints. E.g. with only 3 or 4 datapoints go for constant speed; with 8 or 9 you might justify an acceleration term.
Having chosen the model(s), find the parameters that give the best (least squares) fit to the data. So for constant speed it would be a straight line fit. A more sophisticated approach could involve background knowledge, like expected limits on acceleration (which might depend on the speed). All of that should be manageable in real time, but the results might still not be wonderful. 



#3
Nov2312, 10:50 PM

Sci Advisor
P: 3,175

We should start by using better terminology. Your goal isn' t to "differentiate the data". Your goal is apparently to estimate the velocity of an object from truncated position data. To define a "proper" way, we need to know the penalties for making an error. And what is the overall objective of computing the velocity. Is it an end in itself? Or are you trying to aim a gun to hit a moving target or something where the velocity is merely an aid to the final objective? 



#4
Nov2412, 11:57 AM

P: 443

Differentiating Truncated DataBy the way, since I posted the initial question my group members and I hacked out a solution (involving a moving average), which works just well enough to make the car's motion acceptably smooth. I'm still very curious to hear what someone who knows something about numerical methods would have to say about this problem, though. 



#5
Nov2412, 03:30 PM

Sci Advisor
P: 3,175

I'm not an expert on Kalman filtering, but I might be able to help you with the math just to the extent that i've read about now and then. The engineering sections of the forum would be the place to ask about actually implementing something on a PID controller. 



#6
Nov2512, 07:44 PM

P: 443





#7
Nov2512, 08:21 PM

Sci Advisor
P: 3,175

I see people write articles about Kalman filtering with "quantized data". Perhaps truncated measurements fall into that category.



Register to reply 
Related Discussions  
Truncated Sin Series in FORTRAN  Programming & Computer Science  4  
randomly truncated pdf  Set Theory, Logic, Probability, Statistics  7  
Truncated cones  Advanced Physics Homework  13  
Truncated Octrahedron Mesh  Computing & Technology  5 