1function localF = ex5m(localX,hx,hy,lambda) 2% 3% MATLAB routine that does the FormFunction() for ex5.c 4% when using the MATLAB engine 5% 6[m,n] = size(localX); 7% 8sc = hx*hy*lambda; hxdhy = hx/hy; hydhx = hy/hx; 9% 10% copy over any potential boundary values 11% 12localF = localX; 13% 14% compute interior u and derivatives 15% 16u = localX(2:m-1,2:n-1); 17uxx = (2.0*u - localX(1:m-2,2:n-1) - localX(3:m,2:n-1))*hydhx; 18uyy = (2.0*u - localX(2:m-1,1:n-2) - localX(2:m-1,3:n))*hxdhy; 19% 20% evaluate interior part of function 21% 22localF(2:m-1,2:n-1) = uxx + uyy - sc*exp(u); 23% 24% This uses a clever (though not particularly efficient) way of 25% evaluating the function so that it works for any subdomain 26% (with or without any of the true boundary) 27