Results 1 to 2 of 2

Math Help - Getting gradient vector from f(x,y)?

  1. #1
    Senior Member
    Joined
    Sep 2009
    Posts
    304

    Exclamation Getting gradient vector from f(x,y)?

    I am trying to draw arrows on a graph to show the normal gradient of a function. By gradient, I mean the arrows should follow the surface of the function, not being perpendicular to it.

    For example the function $f(x, y) = 10sin(y - x) => z = 10sin(y - x)$. This is the graph I got




    The arrows are coming very flat (on the x-y plane), and not really following the surface of the function.
    This is what the function looks like



    The problem is its not respecting the z-axis I think.

    The way I generated the $(x,y,z)$ coordinates and the $(u,v,w)$ (this is the direction vector for each arrow) coordinates are:

    Use the function above to get the gradient vector formula (using partial derivatives) which is

    $q(x,y,z) = (-10cos(x - y), 10cos(x - y), -1) = (u,v,w)$

    1. get your $x,y,z,u,v,w$
    2. normalize $u,v,w$
    3. draw the line from $(x,y,z)$ to $(x,y,z)+(u,v,w)*length$

    Here I notice (I'm not sure if this is the problem) that the z component is always -1. Which is why the arrows appear to be flat on the x-y plane.

    Does anyone see whats wrong here?

    Thanks
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Senior Member
    Joined
    Sep 2009
    Posts
    304

    Re: Getting gradient vector from f(x,y)?

    never mind I figured it out. its supposed to be

    (u,v,w) = (cos(theta), sin(theta), (df/dx)(x,y) * cos(theta) + (df/dy)(x,y) * sin(theta))
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: November 1st 2012, 07:05 PM
  2. Gradient Vector max/min
    Posted in the Calculus Forum
    Replies: 1
    Last Post: August 2nd 2009, 03:54 AM
  3. Gradient vector help
    Posted in the Calculus Forum
    Replies: 1
    Last Post: July 6th 2009, 04:04 PM
  4. Gradient Vector
    Posted in the Calculus Forum
    Replies: 1
    Last Post: April 20th 2009, 05:36 PM
  5. Find gradient vector
    Posted in the Calculus Forum
    Replies: 3
    Last Post: May 5th 2008, 02:54 AM

Search Tags


/mathhelpforum @mathhelpforum