How can i find value tends to zero. means value near by zero.

조회 수: 1 (최근 30일)
Triveni
Triveni 2016년 2월 1일
편집: Triveni 2016년 2월 28일
l(:,:,1) =
-0.2881
l(:,:,2) =
-0.2823
l(:,:,3) =
-0.2775
l(:,:,4) =
-0.2767
l (:,:,5) =
0.2733
l(:,:,6) =
-0.3245
I want value near by zero, with Layer No L. example for maximum value
[maxV, L] = max(l);

답변 (1개)

Walter Roberson
Walter Roberson 2016년 2월 1일
[maxV, L] = max(l, [], 3);
  댓글 수: 2
Triveni
Triveni 2016년 2월 1일
편집: Triveni 2016년 2월 28일
If my value(s) between +2 to -2. then how can i find nearest value from zero?..
[maxV, L] = max(l)
gives me same result.
l(:,:,1) =
0.5000
l(:,:,2) =
1
l(:,:,3) =
4
l(:,:,4) =
-10
l(:,:,5) =
2
l(:,:,6) =
-0.9000
l(:,:,7) =
-0.5000
I need nearest value from zero. values may be in positive or negative.
Walter Roberson
Walter Roberson 2016년 2월 1일
You can find the indices by looking at min(abs(l),[],3) and then to get the corresponding values you can index the original matrix at those locations. Someone had a trick for doing that with the layers, but I do not recall what it is at the moment; I usually code the equivalent of sub2ind()

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

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by