Curavture/Slope Filtering

9 visualizaciones (últimos 30 días)
Ian Bunker
Ian Bunker el 14 de Mayo de 2021
Comentada: Star Strider el 17 de Mayo de 2021
I am currently making a program to process some data, part of this process is removing graphs that are sloped, such as the one below:
And retaining graphs that have curvature such as the one below:
I don't come from a strong applied mathematics background, one idea was to take a partial derivative and compare to a set threshold, the curvature formula is another possibility. Does anyone have any experience with this type of problem you would be willing to share?

Respuesta aceptada

Star Strider
Star Strider el 14 de Mayo de 2021
One approach could be to look for changes in the slope (using the gradient function here) with respect to the number of elements in the vector, and reject those with the number of slope changes below a certain threshold.
To illustrate —
changefcn = @(y) numel(y) - nnz(gradient(y)<0);
x = linspace(0, 1); % Use The Same Independent Variable For simplicity
Curve1 = 1./(1+x);
Changes1 = changefcn(Curve1)
Changes1 = 0
figure
plot(x, Curve1)
text(mean(xlim),mean(ylim), sprintf('Changes = %2d',Changes1))
Curve2 = sin(15*pi*x)*0.1 - x;
Changes2 = changefcn(Curve2)
Changes2 = 44
figure
plot(x, Curve2)
text(mean(xlim),mean(ylim), sprintf('Changes = %2d',Changes2))
.
  2 comentarios
Ian Bunker
Ian Bunker el 17 de Mayo de 2021
This is a really versatile way of accomplishing this task, it also preserves the data more than a lengthy mathematical operation with multiple error ranges. Thanks!
Star Strider
Star Strider el 17 de Mayo de 2021
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D 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