필터 지우기
필터 지우기

Desplazate a vector one unity to the right.

조회 수: 2 (최근 30일)
Carlos Martínez
Carlos Martínez 2015년 11월 18일
답변: Walter Roberson 2015년 11월 18일
I have a vector of lenght N, I want to have another vector with the same size but translated to the right. Ex:
x=n1:n2;
y=x(n)-x(n-1);
It's like an discrete differenciation.
Any idea of how to do that?

답변 (1개)

Walter Roberson
Walter Roberson 2015년 11월 18일
You can define
y = x(2:end) - x(1:end-1)
or you can use the built-in routine
y = diff(x)
However, either way this only defines N-1 values and does not define what the N'th value should be.

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by