mrst (matlab reservoir simulation tools)
利用自动离散的函数进行计算
clear all
[a,b,tol] = deal(1,100,1e-6)
tol = 1e-6
[x0,incr] = deal([0;1])
hh =[]
gg = []
ii =[]
while norm(incr)>tol
x = initVariablesADI(x0)
eq = cat( 2*(a-x(1)) - 4*b.*x(1).*(x(2)-x(1).^2), ...
2*b.*(x(2)-x(1).^2));
incr = - eq.jac{1}\eq.val;
x0 = x0 + incr;
hh=[hh x0(1)]
gg = [gg x0(2)]
temp = ((a-x(1)).^2+b.*(x(2)-x(1).^2).^2)
ii=[ii temp.val]
% plot3(x0(1),x0(2),temp.val)
% hold on
end
X = [-1:0.1:2]
Y = [-1:0.1:1]
[xx yy] = meshgrid(X,Y)
a= 1;b =100
figure
surf(xx,yy,(a-xx).^2+b.*(yy-xx.^2).^2)
shading interp
hold on
plo