MATLAB: How to take time derivatives of a function

derivativetime derivativetime function

My objective is to take the first and second time derivatives of my function for displacement 'x'. I have it modelling a function of displacement over angle with respect to time. Does MATLAB have a function that represents dx/dt? Here are the analytical solutions and my code for reference.
h = 60 ;
b =130 ;
r = 28 ;
w = 2*pi; % angular velocity
t =0:(1/36):1 ;
x = b*(r*sin(w*t))./(h-r*cos(w*t));

Best Answer

dxdt = diff(x)./diff(t) ; % derivative of x w.r.t t