Find turning point in data

How to get data gradient and how to locate significant changes of the gradient? I'm trying to locate the first "turning point" of the plot below. Other turning points can be ignored.

2 comentarios

Walter Roberson
Walter Roberson el 22 de Oct. de 2015
How can you tell that it is a turning point? The part to the left of it is not linear so the part to the left of it has places where the slope changes: why are they not turning points?
Hg
Hg el 22 de Oct. de 2015
It's hard. May be by thresholding.

Iniciar sesión para comentar.

 Respuesta aceptada

Image Analyst
Image Analyst el 22 de Oct. de 2015

1 voto

Points like that are often found using a triangle thresholding method. I think there's one in the File Exchange. Basically it draws a line from the peak to the tail and then draws perpendicular lines from that hypotenuse line to the curve. The longest perpendicular line from the hypotenuse to the curve indicates the "corner" of the curve. Maybe that will work for you.

9 comentarios

Hg
Hg el 22 de Oct. de 2015
That's brilliant! Thanks again!
Hg
Hg el 24 de Oct. de 2015
The one in the File Exchange is too complicated. I just made a simple one. To get the so called "turning point", I find the longest distance from the curve perpendicular to the line connecting the two endpoints of the curve.
% Two endpoints on the curve "data"
x = [1 size(data,1)];
y = [data(1) data(end)];
% The slope of the line connecting the two endpoints
m = ( y(2) - y(1) )/( x(2) - x(1) );
pm= - 1 / m;
% Point on the curve (xc,yc), point on the line (xl,yl)
perpDist = zeros(size(data,1),1);
for i = 1:size(data,1)
xc = i ; yc = data(i);
yl = ( (m * xc) + (m^2 * yc) - (m * x(1)) + y(1) )/(1+ m^2);
xl = xc - m*(yl - yc);
% distance^2
d2 = (xl - xc)^2 + (yl - yc)^2;
perpDist(i) = d2;
end
[val, idx] = max(perpDist);
Zhongzheng Wang
Zhongzheng Wang el 18 de Mzo. de 2019
Thanks a lot Hg.
Image Analyst
Image Analyst el 18 de Mzo. de 2019
I'm attaching my triangle thresholding function.
Firas Guechchati
Firas Guechchati el 15 de Oct. de 2020
how do i use this function ?
Image Analyst
Image Analyst el 15 de Oct. de 2020
Editada: Image Analyst el 15 de Oct. de 2020
In the help at the top of the file it says this:
% Sample call:
% binOfThreshold = triangle_threshold(pixelCount, 'R', true);
where pixelCount is your signal, and binOfThreshold would be the index (element number).
Firas Guechchati
Firas Guechchati el 19 de Oct. de 2020
what would be my signal if i have only data and what would be my index
it doesnt really work for me
can i personal message you ?
Image Analyst
Image Analyst el 19 de Oct. de 2020
Your data and your signal are the same thing in that case. The index is the element of the data where your threshold is. Why doesn't it work for you? You can't personally message me but I monitor this forum very closely.
Please start your own thread and attach your data or image, and code. Let's not keep bugging the original poster HG with emails about activity on this discussion.
Firas Guechchati
Firas Guechchati el 20 de Oct. de 2020
sorry my last post
this is the thread
https://de.mathworks.com/matlabcentral/answers/613781-i-plotted-this-and-i-want-to-measure-the-length-and-analyze-the-section-of-this-plot

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

Hg
el 22 de Oct. de 2015

Comentada:

el 20 de Oct. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by