se me pidió calcular el vector gradiente de una función introducida por el usuario SIN USAR EN COMANDO GRADIENTE, esto es lo que tengo, tambien añadí la opción de graficar
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
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2022-2-17
What is the idea behind doing the
syms v
??
Consider instead doing diff(sf, v(1)) and diff(sf, v(2)) as two calls.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Calculus 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!