필터 지우기
필터 지우기

creating an interval from vector array

조회 수: 21 (최근 30일)
Henry Barker
Henry Barker 2021년 9월 1일
댓글: Henry Barker 2021년 9월 1일
I have for example a vector V = [1 2 3 4 5 6 7 8 9 10]'
I would like to create intervals in which each interval starts with the with the ending of the previous interval, Meaning interval 1: 1-2, interval 2: 2-3, interval 3: 3-4 and so on.
is there a certain command for that?

채택된 답변

Chunru
Chunru 2021년 9월 1일
V = [1 2 3 4 5 6 7 8 9 10]';
i = 4; % interval 4
interval = V(i:i+1)'
interval = 1×2
4 5

추가 답변 (1개)

Walter Roberson
Walter Roberson 2021년 9월 1일
V = [1 2 3 4 5 6 7 8 9 10]'
V = 10×1
1 2 3 4 5 6 7 8 9 10
intervals = buffer(V,2,1,'nodelay')
intervals = 2×9
1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 10
Now take the columns of intervals.
This requires the Signal Processing Toolbox.
... and is easy enough to create on your own:
intervals = [V(1:end-1), V(2:end)].'
intervals = 2×9
1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 10
  댓글 수: 1
Henry Barker
Henry Barker 2021년 9월 1일
perfect thanks a lot, thats exactly what I wanted

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

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by