MATLAB Answers


Contourf matrix plot contour

Asked by Mehdi
on 30 Sep 2013
Latest activity Commented on by Walter Roberson
on 4 Oct 2013

I have written a code to graph contours of a matrix in 2D. However, although i have values of MY2 <10, when it is plotted there is a white area for MY2<10. Would you please help me with this. I have checked this several times and it seems to be alright!

All required files have been attached in a ZIP file.

Files can be downloaded from the following link

  1 Comment

Your zip files did not appear to get attached.

Please show the contourf() call you use.



No products are associated with this question.

2 Answers

Answer by Walter Roberson
on 1 Oct 2013

The call


requests that 10 contour levels be used, not a single contour level at value 10. To use a single contour level at value 10, code

[C, M] = contourf(MX2, MY2, MR2, [10 10]);

  1 Comment

on 1 Oct 2013

Thanks i will try your suggestion now. But I meant to have the contour values of MR2, MV2 and MU2 when MY2=10 or less. Currently the region with MY2<10 has no contour of MR2, MV2 or MU2 and is solid white.

Answer by Mehdi
on 4 Oct 2013

Any help is highly appreciated

  1 Comment

Why not use logical indexing to find the cut-plane for MY2 being 10, and applying that logical index to MX2, MY2, MR2, and contourf() the result ?

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!