Finding an initial point, then skipping a certain amount of points.

조회 수: 12 (최근 30일)
So here is what I've done so far. t=1:.5:50; randn('state',0); x=sin(2*pi*t); x=2*randn(size(t)); plot(x)
In order to create a random wave form. Now I wish to find the first point over 2, but then skip the next 5 points, regardless if its greater than 2 or not. Then I wish to skip the next five points again, and so forth until the end. This is a mere practice exercise for me, and I am still a learning student. Thanks in advance.
  댓글 수: 4
Benjamin
Benjamin 2011년 9월 3일
Because In that question, I wanted to find points greater than two, in this I want to find the first point over the threshold, then skip five points and find the next point regardless of its value.

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

채택된 답변

Walter Roberson
Walter Roberson 2011년 9월 3일
wantedvalue = x(find(x>2,1,'first') + 5);
  댓글 수: 2
Oleg Komarov
Oleg Komarov 2011년 9월 3일
Till the end:
x(find(x>2,1,'first'):6:end)
where for skipping I consider that you wanna leave five in between.
Benjamin
Benjamin 2011년 9월 3일
Getting better everyday, thanks for your help

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by