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

 Réponse acceptée

Star Strider
Star Strider le 30 Oct 2018

1 vote

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

6 commentaires

KHAN
KHAN le 30 Oct 2018
Thank you very much for your answer.
KHAN
KHAN le 30 Oct 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 le 30 Oct 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.
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 le 31 Oct 2018
Thank you Star Strider.
Star Strider
Star Strider le 31 Oct 2018
As always, my pleasure.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by