Calculate the gradient of a function
Show older comments
Hello. I want to calculate the gradient of the function :
g={@(x)-x;@(x)x-1;@(y)-y;@(y)y-1};
with the following command :
gradient(g, [x, y]);
but I get the following error :
Undefined function or variable 'x'.
How I should proceed? Thanks.
Accepted Answer
More Answers (1)
garrett batt
on 26 Aug 2021
0 votes
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!