Created
September 9, 2017 21:32
-
-
Save cshjin/cf4d98c8ed473dda64f5cfd3d1645e78 to your computer and use it in GitHub Desktop.
Saddle point example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v = -5:0.5:5; | |
[x, y] = meshgrid(v); | |
z = x .* exp(x.^2 - y.^2) + y.*exp(-x.^2 + y.^2); | |
[px, py] = gradient(z); | |
figure | |
surf(x, y, z) | |
figure | |
contour(x, y, z); | |
hold on | |
quiver(x, y, px, py); | |
hold off | |
v = -5:0.5:5; | |
[x, y] = meshgrid(v); | |
z = (x.^2 - y.^2); | |
[px, py] = gradient(z); | |
figure | |
surf(x, y, z); | |
% hold on | |
% quiver3(x, y, px, py); | |
% hold off | |
figure | |
contour(x, y, z); | |
hold on | |
quiver(x, y, px, py); | |
hold off |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment