Vector Difference

2 次查看(过去 30 天)
Mark
Mark 2011-11-24
Given a vector x=[2 5 6 10 16 29].
Is there a one line command to create another vector that is the difference between the last elements (first element of x is first element of y)?
Example Output: y=[2 3 1 4 6 13]

采纳的回答

David Young
David Young 2011-11-24
y = [x(1) diff(x)]
  1 个评论
Mark
Mark 2011-11-24
I appreciate the quick response. Excellant. Thankyou.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by