Gradient of a 2D plot
Afficher commentaires plus anciens
I have a 2D plot of potential (V) (circular contour plot). I have to find the electric field (E) by taking the gradient. How is it possible to see the gradient of V. [U,W]=gradient(V) returns the gradient in X and Y direction and quiver(X,Y,U,W) helps to visualize the vector field. How is it possible to view effective gradient. Contour (X,Y,U) will only help me to see gradient in x direction. How can I see the effect of gradient which is a vector sum of both gradient in X and Y.?
2 commentaires
Ameer Hamza
le 30 Sep 2020
What is wrong with quiver. It generates arrows in the gradient direction.
Prince Alex
le 30 Sep 2020
Réponse acceptée
Plus de réponses (1)
KSSV
le 30 Sep 2020
M = sqrt(U.^2+W.^2) ;
contour(X,Y,M)
1 commentaire
Prince Alex
le 30 Sep 2020
Modifié(e) : Prince Alex
le 30 Sep 2020
Catégories
En savoir plus sur Vector Fields 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!