I was asked to calculate the gradient vector of a function entered by the user WITHOUT USING THE GRADIENT COMMAND. This is what I have, but is wrong I also added how to grap

4 views (last 30 days)
f = input('enter function ','s');
sf = str2sym(f);
v = symvar(sf);
g = diff(sf,v);
[x,y] = meshgrid(-5:0.2:5,-5:0.2:5);
u=eval(g(1));
v=eval(g(2));
quiver3(x,y,u,v)
  8 Comments
Yulissa Gallardo
Yulissa Gallardo on 17 Feb 2022
I've already done it, I just need to graph it, my friend, thank you so much, you don't know how much you helped me today!

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!