%% m21_newtonsystemChebfun2.m - same as m20 but with Chebfun2 % See chapter 14 of Chebfun Guide at www.chebfun.org %% Two scalar functions on unit square: cheb.xy % chebfun2 objects x and y F1 = sin(x+y) - exp(-x.^2); F2 = 3*x - x.*y.^2-1; contour(F1,20), axis equal, colorbar hold on plot(roots(F1),'k','linewidth',2) plot(roots(F2),'r','linewidth',2) roots(F1,F2) %% Alternatively, one vector function: F = chebfun2v(F1,F2); figure, quiver(F,'k','numpts',20) roots(F) hold on, plot(ans(1),ans(2),'.','markersize',30)