function regionvs(a,b,g1,g2)
% regionvs(a,b,g1,g2)
%
% plot vertically simple region
%   a <= x <= b
%  g1 <= y <= g2
% where g1,g2 are symbolic expressions of x.
% 
% Example: circle of radius 1 and center (0,0)
%   syms x
%   g1 = -sqrt(1-x^2)
%   g2 = sqrt(1-x^2)
%   regionvs(-1,1,g1,g2)
%   axis equal; axis tight

syms x
a = double(a); b = double(b);
g1 = sym(g1); g2 = sym(g2);

hs = ishold;
ezplot(g1,[a,b]); hold on           % bottom boundary of R
ezplot(g2,[a,b]);                   % top boundary of R
xv = linspace(a,b,25);              % use vector of 25 x-values from a to b
g1v = subs(g1,x,xv);                % corresponding g1-values
g2v = subs(g2,x,xv);                % corresponding g2-values
plot([xv;xv],[g1v;g2v],'r');        % draw vertical lines in red
if hs==0
  hold off
end



