% % code3Mc.m -- 16 sept 02 -- djm % % contour plotter % clear workspace & graphics clear; close all % set t & v grid matrices ("help meshgrid") x = -5:0.05:5; y = -5:0.05:5; [xx,yy] = meshgrid(x,y); % calculate constant (matrix arithmetic, use , .* etc) K = 0.5*(xx.^2 - yy.^2) + exp(-xx) - exp(yy); % plot tangent vectors ("help quiver") figure(1); hold on contour(x,y,K,[-8:2:8],'r') contour(x,y,K,[0 0],'k') axis([-5 5 -5 5]) % label plot title(['integral curves (prob 2.2.7)']) xlabel('x-axis') ylabel('y-axis')