Numerical derivative of points

Dear All: I have the y and x values and I want to get the dy/dx for each point without losing any point.What is the best way of function with a high precision to be used to find the dy/dx? Please help me with this issue. Thanks. With my best regards, Mohammed

 Respuesta aceptada

Star Strider
Star Strider el 30 de Oct. de 2018

1 voto

I would use the gradient (link) function. The output is the same size as the imput.

6 comentarios

KHAN
KHAN el 30 de Oct. de 2018
Thank you very much for your answer.
KHAN
KHAN el 30 de Oct. de 2018
Dear Star Strider: I have checked the gradient function. It is assumed that the spacing between points in each direction is assumed to be 1. In my case, the spacing between points in each direction is not the same. Could explain more on this problem? Thanks. Mohammed
John D'Errico
John D'Errico el 30 de Oct. de 2018
Did you look at the other arguments to gradient? If not, why not? That is, if you have a difference that is not 1, you can still solve the problem using gradient.
Star Strider
Star Strider el 30 de Oct. de 2018
The function assumes the same spacing for the points, although it does not have to be 1. You can set it with the ‘h’ variable. One way to get ‘dy/dx’ using the function is:
h = some_value;
dydx = gradient(y, h) ./ gradient(x, h);
Experiment to get the result you want.
KHAN
KHAN el 31 de Oct. de 2018
Thank you Star Strider.
Star Strider
Star Strider el 31 de Oct. de 2018
As always, my pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Preguntada:

el 30 de Oct. de 2018

Comentada:

el 31 de Oct. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by