Find a position of last changing value in array

조회 수: 2 (최근 30일)
Nik Rocky
Nik Rocky 2020년 6월 7일
댓글: Nik Rocky 2020년 6월 7일
Hello,
i'm looking for function that detect a position of detection of last changing value (value stay constant or have just little changes).
In this case tube_dimension = 37;
I'm realize this in for-loop, but maybe thereare better way?
Sensivity_old = Sensivity;
TP ...
FN ....
Sensivity = (TP ./ (TP + FN));
if (Sensivity > Sensivity_old + 1.0e-03)
Sencivity_end = tube_cnt;
else
end
disp(Sencivity_end)
Thank you!

채택된 답변

Umair Hassan
Umair Hassan 2020년 6월 7일
편집: Umair Hassan 2020년 6월 7일
Hi Nikita,
You can use MATLAB's built in function differentrial (diff) to find out the minimum variability points of your data. The first index of the those points would be where your data would have the plateau. If you can attach some data, I would give you a code as well, otherwise psuedo code is:
plateau_points=diff(sensitivity);
plateau_points=find(plateau_points ==0) % finding where the points have 0 change
plateau_tube_dimension=tube_dimension(plateau_points(1));
Hope this helps,
Thanks!
  댓글 수: 1
Nik Rocky
Nik Rocky 2020년 6월 7일
Hi Hassan,
thanks for your response!
I trieded to do your Answer:
My input is:
Sensivity =
Columns 1 through 18
0.8749 0.8806 0.8860 0.9100 0.9114 0.9130 0.9361 0.9374 0.9480 0.9493 0.9539 0.9559 0.9576 0.9586 0.9596 0.9606 0.9609 0.9612
Columns 19 through 36
0.9619 0.9622 0.9626 0.9632 0.9639 0.9649 0.9659 0.9665 0.9672 0.9675 0.9675 0.9679 0.9682 0.9685 0.9685 0.9712 0.9728 0.9745
Columns 37 through 50
0.9768 0.9771 0.9771 0.9771 0.9771 0.9771 0.9771 0.9771 0.9771 0.9771 0.9771 0.9771 0.9771 0.9771
after
plateau_points=diff(Sensivity)
I get:
plateau_points =
Columns 1 through 18
0.0057 0.0054 0.0241 0.0013 0.0017 0.0231 0.0012 0.0106 0.0013 0.0046 0.0020 0.0017 0.0010 0.0010 0.0010 0.0003 0.0003 0.0007
Columns 19 through 36
0.0003 0.0003 0.0007 0.0007 0.0010 0.0010 0.0007 0.0007 0.0003 0 0.0003 0.0003 0.0003 0 0.0027 0.0017 0.0017 0.0023
Columns 37 through 49
0.0003 0 0 0 0 0 0 0 0 0 0 0 0
after:
plateau_points=diff(Sensivity);
plateau_points=find(plateau_points > 0); % finding where the points have 0 change
plateau_tube_dimension = nonzeros(plateau_points(end));
I get 37! Is a right one. Thank you very much!

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by