试一下gradient和quiver函数,你只要知道你这个图能量(势能)的表达函数,就不难画。
举个例子:
[x,y] = meshgrid(-2:.2:2,-1:.15:1);
z = x .* exp(-x.^2 - y.^2); [px,py] = gradient(z,.2,.15);
contour(x,y,z), hold on
quiver(x,y,px,py), hold off, axis image
运行结果: