i need to find acceleration of an object the formula for that given in text is a = d^2(L)/d(T)^2 , where L= length and T= time
i calculated this in matlab by using this equation
a = (1/(T3-T1))*(((L3-L2)/(T3-T2))-((L2-L1)/(T2-T1)))
or
a = (v2-v1)/(T2-T1)
but im not getting the right answers ,can any body tell me how to find (a) by any other method in matlab.
This has nothing to do with matlab, you are just trying to numerically differentiate a function twice. Depending on the behaviour of the higher (3rd, 4th) derivatives of the function this will or will not yield reasonable results. You will also have to expect an error of order
|T3 - T1|^2with a formula like the one you are using, assuming L is four times differentiable. Instead of using intervals of different size you may try to use symmetric approximations likeFrom what I recall from my numerical math lectures this is better suited for numerical calculation of higher order derivatives. You will still get an error of order
with
||.||denoting the supremum norm of a function (that is, the fourth derivative of L needs to be bounded). In case that’s true you can use that formula to calculate how small h has to be chosen in order to produce a result you are willing to accept. Note, though, that this is just the theoretical error which is a consequence of an analysis of the Taylor approximation of L, see [1] or [2] — this is where I got it from a moment ago — or any other introductory book on numerical mathematics. You may get additional errors depending on the quality of the evaluation of L; also, if|L(x-h) - L(x)|is very small numerical substraction may be ill conditioned.[1] Knabner, Angermann; Numerik partieller Differentialgleichungen; Springer
[2] http://math.fullerton.edu/mathews/n2003/numericaldiffmod.html