Find a position of last changing value in array

2 visualizaciones (últimos 30 días)
Nik Rocky
Nik Rocky el 7 de Jun. de 2020
Comentada: Nik Rocky el 7 de Jun. de 2020
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!

Respuesta aceptada

Umair Hassan
Umair Hassan el 7 de Jun. de 2020
Editada: Umair Hassan el 7 de Jun. de 2020
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 comentario
Nik Rocky
Nik Rocky el 7 de Jun. de 2020
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!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Distribution Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by