% % code3Ma.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.025:0.05:5.025; [xx,yy] = meshgrid(x,y); % calculate constant (matrix arithmetic, use , .* etc) K = -1./yy - cos(xx); % plot tangent vectors ("help quiver") figure(1); hold on contour(x,y,K,[0 0],'k') contour(x,y,K,[-2.0:0.5:-0.5],'r--') contour(x,y,K,[0.5:0.5:2.0],'r') axis([-5 5 -5 5]) % label plot title(['\bf ODE solutions (prob 2.2.3)']) xlabel('x-axis') ylabel('y-axis (K=0 in black, K<0 in red dash, K>0 in red solid)')