[X1,X2] = meshgrid(-8:.2:8,-10:.2:10); contour(X1,X2, sin(X1-X2) + X1.^3./20 ,[0 0],'b-'); hold on contour(X1,X2, cos(X1+X2) - X2.^2./20 ,[0 0],'r--'); hold off
Note that you MUST use .* ./ .^ instead of * / ^ for element-wise arithmetic operations with the arrays X1 and X2.