i want to obtain a vector that each element is subtract from the previous one

조회 수: 1 (최근 30일)
if i have values q={3 6 8 10 12 15 16} and i want to obtain a vector that gives me: k={3 3 2 2 2 3 1}
K(ii)=q(ii)-q(ii-1)
how can i do that

채택된 답변

Fangjun Jiang
Fangjun Jiang 2021년 4월 30일
diff()

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by