How do I plot velocity after differentiating displacement with respect to time?

3 visualizaciones (últimos 30 días)
I have successfully managed to differentiate displacement to find velocity. However, i am then unable to plot a figure of velocity versus time, or differentiate again to find acceleration, as the vectors are of different sizes.
How can I fix this?
Thanks.

Respuesta aceptada

Star Strider
Star Strider el 1 de Feb. de 2017
use the gradient function for the numerical derivative, not diff. (Use del2/4 for the second derivative.) The diff function does successive differences, so the output is one element shorter than the input. The gradient function is a numerical derivative function, so the output will be the same length as the input. See the documentation for the various functions for details.

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by