Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica, gradient plot on the graph

  1. Aug 1, 2012 #1
    I need to plot a vector field 2x,2y,0 which is the gradient of the function x^2+y^2. I need to plot it only in some interesting points (points on the paraboloid x^2+y^2). So I tried something like


    It did not work. The definition of ListVectorPlot3D[{{x,y,z},{a,b,c}},...] says that it generates a 3D vector plot from vector field values {a,b,c} given at specified points {x,y,z}.

    Any idea how I might plot that gradient on the paraboloid ? It would be really unpleasant if I had to do every single vector with Graphics3D[]

  2. jcsd
  3. Aug 2, 2012 #2


    User Avatar
    Gold Member

    Code (Text):

    pnts = Flatten[Table[{x, y, x^2 + y^2}, {x, -2, 2, 1/4}, {y, -2, 2, 1/4}], 1];

    plv = VectorPlot3D[{2 x , 2 y, 0}, {x, -2, 2}, {y, -2, 2}, {z, 0, 8},  VectorPoints -> pnts, VectorColorFunction -> "ThermometerColors",    VectorScale -> Small];

    plp = Plot3D[x^2 + y^2, {x, -2, 2}, {y, -2, 2},  ColorFunction -> "GrayTones", BoxRatios -> {3, 3, 2}];

    Show[plp, plv, ImageSize -> 600]
    Gives me this: It took me a bit of time, but I have always wanted to learn how to do this anyway so 30 minutes well spent.

    Does anyone know how i can make the arrows START at the point rather than be centered at it?

    Attached Files:

    Last edited: Aug 2, 2012
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Mathematica gradient plot Date
Mathematica Cannot do the integral of the Hyper-geometric function? Mar 11, 2018
Mathematica Cannot Plot This Function in Mathematica Feb 26, 2018
Mathematica While Loop in Mathematica Feb 25, 2018
Mathematica Mathematica Real Part Feb 24, 2018
Help on conjugate gradient programm in matlab Apr 17, 2011