MATLAB: Contour plot not working (but contour3 plot does work)

contourcontour plotcontour3MATLAB

Hello everyone,
For some reason when I use the 'contour' function, it just gives me a blank figure. On the other hand, if I use 'contour3' it displays the 3-D contour plot. Any suggestions why this may be happening?
I have a 31×1 double (x-axis), a 19×1 double (y-axis), and a 31×19 double (z-axis).
– First, I use meshgrid with the x and y-axis, which gives me a 19×31 and 19×31 respectively.
– Next, I transpose the z-axis to obtain a 19×31 (just as the other 2 axis)
– Finally, I plot them and obtain the desired surface and mesh plots; but, I am unable to obtain the contour plot as I mentioned above.
Thank you in advance for any help provided.

Best Answer

I am still not sure why the 'contour' function did not work for me. It must be some bug in my code.
I ended up using the 'contour3' function. To obtain the regular contour, I use the 'rotate 3D' toolbar and by right clicking on the plot it gives the option to "Go to X-Y view" which is the regular contour.
Related Question