MATLAB: A question about how to solve a second order system by application of ODE and how to apply function xdot

function xdotodes solving

Sorry, everyone, I am a freshman to Matlab and I just want to know what means function xdot and xdot=xdot'. And more detailed information can be found in the screenshot below. This function is used to calculate the distance travelled by train. This process needs to do the calculation process of a second order system with two state parameters: Time and Speed.

Best Answer

You would pass a function handle to trainDynamics to the ode solver, e.g. ode45, along with a time span and initial value vector. The xdot = xdot' line simply turns xdot into a column vector for output. See the example in the doc for solving 2nd order ode's:
In particular, you would be passing in @trainDynamics for the function handle in your case.
Related Question