MATLAB: Plot contour in xz and yz plane

axescontourMATLABplanesurface

I am trying to plot contours in xy, yz and xz plane simultaneously. The contour is for a surface (Z = f(X,Y)). I made the contour on xy plane but not on any other plane. A similar question was answered but it does not plot the contour in xz or yz plane.

Best Answer

Create a hgtransform object inside the axes, say HG. Now call contourf() passing in the hgtransform object, HG, in the first position -- the position for axes. Pass the first independent variables in the first position, the second independent variable in the second position, and the resultant variable in the third position.
Now set the Matrix property of the hgtransform to a rotation matrix that rotates from XYZ coordinates into the axes you want. You may wish to use makehgtform to construct the Matrix property.
If you wish to have additional contours on other planes, repeat the process described.