How do I plot velocity after differentiating displacement with respect to time?
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Star Strider
2017-2-1
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!