필터 지우기
필터 지우기

Howe can I subtract neighboring numbers?

조회 수: 1 (최근 30일)
Max Behr
Max Behr 2019년 7월 7일
댓글: Max Behr 2019년 7월 7일
Hello,
I got a matrix like this:
>> z=[1,2,3,4]
z =
1 2 3 4
How can I substract the neighboring numbers?
Like 2-1; 3-2; 4-3; etc.
And how can I divide every number by 60 ?
Like 1/60 2/60 etc

채택된 답변

Andrei Bobrov
Andrei Bobrov 2019년 7월 7일
  댓글 수: 5
Andrei Bobrov
Andrei Bobrov 2019년 7월 7일
편집: Andrei Bobrov 2019년 7월 7일
diff([0,z(:)'])
or
diff([0;z])
Max Behr
Max Behr 2019년 7월 7일
Thanks works fine!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by