how to find the local Slope of a curve in each point

13 visualizaciones (últimos 30 días)
Dimitrios
Dimitrios el 24 de Sept. de 2014
Editada: Dimitrios el 24 de Sept. de 2014
how to calculate the local slope degree of this curve in its point having the x and y values of the curve:
I tried to do it with the following :
slope = diff(y) ./ diff(x);
or :
slopeY = (y(2:end) + y(1:end-1))/2;
but my results doesnt seem to be correct. Thank you.
  2 comentarios
Adam
Adam el 24 de Sept. de 2014
In what way do the results not seem correct? Do you have manually calculated results that differ?
Star Strider
Star Strider el 24 de Sept. de 2014
I would use gradient rather than diff, since the output vector is the same length as the input vector.

Iniciar sesión para comentar.

Respuestas (1)

the cyclist
the cyclist el 24 de Sept. de 2014
One possibility is to use the movingslope function from the File Exchange.

Categorías

Más información sobre MATLAB 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