substract an element from previous element in a matrix
이전 댓글 표시
i have a k vector that contains 5 elements.
i want to write a code that substract - the second element from first
- the third element from second
- the fourth element from third
- the fifth element from fourth
and put them all in a vector form that will contain 4 elements
b=[k(2)-k(1) k(3)-k(2) k(4)-k(3) k(5)-k(4)];
how can i do that?
답변 (1개)
Star Strider
2022년 5월 10일
0 개 추천
댓글 수: 3
Mahmoud Chawki
2022년 5월 10일
Torsten
2022년 5월 10일
b = diff(k.^2)
Star Strider
2022년 5월 10일
@Torsten — Thank you!
카테고리
도움말 센터 및 File Exchange에서 Correlation and Convolution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!