Gradient of a vector

12 visualizaciones (últimos 30 días)
Bhaskarjyoti
Bhaskarjyoti el 28 de Ag. de 2013
I have 3 vectors X(i,j);Y(i,j) and Z(i,j).Z is a function of x and y numerically. I want to plot the gradient of z with respect to x and y. Can anyone suggest me how to find the gradient in the above case? Thanks, -Bhaskar

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Ag. de 2013
Is it a rectangular grid? [X, Y] = ndgrid(Xv, Yv) for some vector Xv, Yv ?
If so, then
gradient(Z, xv, yv)
  2 comentarios
Bhaskarjyoti
Bhaskarjyoti el 30 de Ag. de 2013
yeah it is a rectangular grid. And it works. Thanks a lot.
Muthu Annamalai
Muthu Annamalai el 30 de Ag. de 2013
@walter I love the gradient + quiver plots. Reminds me of the swirling fields.. http://www.mathworks.com/help/matlab/ref/gradient.html?searchHighlight=gradient

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 28 de Ag. de 2013
Wouldn't it be diff(Z) ./ sqrt(diff(X).^2 + diff(Y).^2) or something pretty similar to that?
  1 comentario
Bhaskarjyoti
Bhaskarjyoti el 30 de Ag. de 2013
Thanks. I could do it by gradient(z,x,y).

Iniciar sesión para comentar.

Categorías

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