Plotting Contours Easily In MatLab® With ‘ezcontour()’ Command

Unlike other graph drawing methods in Matlab®, you can draw the contours of polynomials and equations more easily with the ‘ezcontour()’ command in Matlab®. Here, we explain how to use the ‘ezcontour()’ command and variations of it in Matlab® to obtain 2D graphs with two variables. Check the examples below that are executed in the Matlab® command window. 

How To Use ‘ezcontour()’ Command In MatLab®?

>> ezcontour('3*x^2+3*y+8')

In this example here, we just executed the ‘ezcontour()’ command by writing an equation inside it. This equation includes two symbolic variables. So, you do not need to define it before the ‘ezcontour()’ command.

YOU CAN LEARN MatLab® IN MECHANICAL BASE; Click And Start To Learn MatLab®!

We use ‘x’ and ‘y’ variables inside the command, and the graph will have ‘x’ and ‘y’ axes as you see below.

>> ezcontourf('3*x^2+3*y+8',[1 100],[1,100])

In this example, we used the ‘ezcontourf()’ command. This command creates plottings that are filled with transition colors as you see in the output below.

Also, you can add boundaries to the ‘x’ and ‘y’ axes by defining them in the example above. The two axes have an interval between 0 to 100. You can define it differently. The plot is created between this interval.


As you understand the ‘ezcontour()’ command is very simple to use to obtain 2D graphs with two variables. 

Do not forget to leave your comments and questions below about the use of the ‘ezcontour()’ command in Matlab® below. 

If you want further coding examples about the ‘ezcontour()’ command in Matlab®, inform us in the comments.

This article is prepared for completely educative and informative purposes. Images used courtesy of Matlab®

Your precious feedbacks are very important to us.


Leave a Reply

Your email address will not be published. Required fields are marked *