clear
clf
view(3)
axis equal
hold on

syms x y z real
f1 = x^2 - y + z^2/4
f2 = x - 2 * z^2
[xi, zi] = solve( f1, f2, 'x,y' );

v = -1:0.2:1;
[mx, mz] = meshgrid( v );
my = mx;

s1 = solve( f1, 'y' );
yy = double( subs( s1, {x, z}, {mx, mz} ) );
mesh( mx, yy, mz );

s2 = solve( f2, 'x' );
xx = double( subs( s2, z, mz ) );
mesh( xx, my, mz );

xxi = double( subs( xi, z, v ) );
yyi = double( subs( zi, z, v ) );
h = plot3( xxi, yyi, v, 'r-x' );
set( h, 'linewidth', 2 );
