How do I plot velocity after differentiating displacement with respect to time?
3 views (last 30 days)
Show older comments
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.
0 Comments
Accepted Answer
Star Strider
on 1 Feb 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.
0 Comments
More Answers (0)
See Also
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!