function zerocont2(f,lim)
% zerocont2(f,[x1min x1max x2min x2max])
% plot zero contours of vector valued function in rectangle 
% function f maps a vector of length 2 to a column vector of length 2
% Use @f if function is given in m-file f.m
%
% Example:
% f = @(x) [x(1)^2+x(2)^2-2; x(2)-1]
% zerocont2(f,[-2 2 -2 2])

warning('off','MATLAB:fplot:NotVectorized')
hs = ishold;

fimplicit(@(x1,x2)[1 0]*f([x1;x2]),lim,'b'); hold on;
fimplicit(@(x1,x2)[0 1]*f([x1;x2]),lim,'r'); 

xlabel('x_1'); ylabel('x_2')
if ~hs hold off; end 
axis equal; axis(lim); 
title('zero contours of f_1 (blue) and f_2 (red)')
warning('on','MATLAB:fplot:NotVectorized')

