필터 지우기
필터 지우기

Ho to do

조회 수: 1 (최근 30일)
Sukumar Palo
Sukumar Palo 2011년 2월 24일
hi
I have an array of 50 data points as 1X50. I want to find out 3 points prior to the maximum value in the array.
eg: the maximum value is on 27th position I want solution that will return the 24th position in the array
how to do it
thanx in advance
  댓글 수: 2
Robert Cumming
Robert Cumming 2011년 2월 24일
what have you tried?
Jan
Jan 2011년 2월 24일
You have posted the same question in CSSM. Rossposting confuses the people, who want to help you.

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

답변 (1개)

Jan
Jan 2011년 2월 24일
Have you read the help text of MAX?
x = rand(1, 50);
[maxValue, maxIndex] = max(x);
maxIndexMinus3 = maxIndex - 3;
Most likely this might cause troubles if the first element is the maximum. So perhaps you want this:
maxIndexMinus3 = max(1, maxIndex - 3);
  댓글 수: 3
Robert Cumming
Robert Cumming 2011년 2월 24일
you still need to find where the max is. Jan has given you the answer - have you tried it?
Jan
Jan 2011년 2월 24일
What exactly are the inputs of your problem? Do you know the index of the maximum initially? Then use just the last line I've posted. If you don't now the index of the maximum, the function has to find it of course.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by