Azzera filtri
Azzera filtri

What is the algorithm used by gradient in Matlab?

1 visualizzazione (ultimi 30 giorni)
I have been using the gradient function in Matlab to run some simulations, and have been using it like a black box, but I would like to know how exactly is the gradient calculated by Matlab. Is it by centered differences? How does it compute the gradient near the edges of the array for which you want to calculate the gradient?

Risposta accettata

Walter Roberson
Walter Roberson il 27 Ago 2012
You can examine the source code:
type gradient
It uses forward differences at the edges, and centered differences in the interior.
  1 Commento
Jan
Jan il 27 Ago 2012
Looking into the help section (help gradient), the documentation (doc gradient) and in the source code (type gradient) are three strategies to solve such problems locally without the need to ask the forum.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by