%% Second Derivative of Vector
% Calculate the acceleration of an object from a vector of position data.
% Create a vector of position data.

p = [1 3 6 10 16 18 29];

%
% To find the acceleration of the object, use del2 to calculate the second numerical derivative of p. Use the default spacing h = 1 between data points.

L = 4*del2(p)

% Each value of L is an approximation of the instantaneous acceleration at that point.
% Copyright 2015 The MathWorks, Inc.