Let f(z) be a complex function. Suppose I wanted to plot the contours where the imaginary part, imag(f(z)) = 0, but the real part positive. An example code would be
x = linspace(-2, 2, 50);
y = linspace(-2, 2, 50);
[xmat, ymat] = meshgrid(x, y);
z = xmat + 1i*ymat;
f = sqrt(z);
[C, h] = contour(x, y, imag(f), [0 0]);
This gives me the contours with imag(f) == 0. However, I'd like to only plot contours with imag(f) == 0 && real(f) >= 0. Is there an easy way to do this?