EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • All Courses
    • All Specializations
  • Blog
  • Enterprise
  • Free Courses
  • All Courses
  • All Specializations
  • Log in
  • Sign Up
Home Data Science Data Science Tutorials Matlab Tutorial Matlab ezplots
 

Matlab ezplots

Priya Pedamkar
Article byPriya Pedamkar

Updated July 6, 2023

Matlab ezplots

 

 

Introduction to Matlab ezplots

MATLAB is also a great tool for visualization. It provides us with the ability to create a wide variety of plots. In this article, we will focus on ezplot function for creating plots of functions and equations.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Syntax:

Let us understand the Syntax of ezplot function in MATLAB

  1. ezplot (f)
  2. ezplot (f, [minimum, maximum])
  3. ezplot (x, y)

Description of Matlab ezplots

  1. ezplot (f):
    1. ezplot (f) will create a plot of an equation, symbolic expression, or a function passed as an argument
    2. Ezplot (f), by default, will plot a function or an expression over [–2π to2π] or a subinterval of [–2π to 2π]
  2. ezplot (f, [minimum, maximum]):
    1. This function will plot the input function or equation over the range passed in the argument
  3. ezplot (x, y):
    1. This function will plot the planar-defined curves x and y over 0 <= z <= 2π or over a subset of 0 <= z <= 2π

Examples

Let us understand ezplot (f) with a couple of examples:

Example #1

Let us take a simple example of the sine function and try to plot it using ezplot.

syms x[initializing variable x] ezplot(sin(x))[passing the input function]

[Here, notice that we have not passed any argument for the interval, so by default, ezplot function will plot the sine wave in the interval [–2π to 2π] ]

Input:

syms x
ezplot(sin(x))

Output:

Matlab ezplots 1

As we can see in our output, the sin function is plotted between the range [–2π to 2π] ].

Next, we will pass an argument to define the interval for our output.

Example #2

Let us take a cos function and try to plot it using ezplot in the range 0 to 2π

syms x[initializing variable x] ezplot(cos(x), [0, 2 * pi])[passing the input function and the required interval]

[Here, notice that we have passed [0 to 2π] as an argument for the interval]

Input:

syms x
ezplot(cos(x), [0, 2 * pi])

Output:

Matlab ezplots 2

As we can see in our output, the cos function obtained is in the range 0 to 2 pi; as expected by us.

Example #3

In this example, we will use ezplot (x, y) to create a plot of a straight-line equation

syms x y[initializing variables x& y] ezplot(x == 5 * y )[passing the input straight line equation]

[Notice the double equal to sign for representing ‘=’ ]

Input:

syms x y
ezplot(x == 5 * y )

Output:

Output 3

As we can see, we have obtained a graph for the equation of a straight line.

Example #4

In this example, we will plot an equation for a sphere using ezplot (x, y).

syms x y[initializing variables x& y] ezplot(x ^ 2 + y ^ 2 == 25 )[passing the equation of a sphere with radius 5]

[Notice the double ‘equal to’ sign for representing ‘=’ ]

Input:

syms x y
ezplot(x ^ 2 + y ^ 2 == 25 )

Output:

Output 4

As we can see in our output, we have obtained a sphere of radius 5 sing ezplot function.

Conclusion

MATLAB can be used to plot our data for visualizing and intuitively understanding it. There could be instances when we have to plot equations or functions. In such cases, we make use of ‘ezplot’ function in MATLAB. We can make use of the default range or define our own range for plotting the functions or equations.

Also, remember that if an equation or function is of 2 variables, then the variable which comes first alphabetically will come on the horizontal axis & the other one will be on the vertical axis.

Recommended Articles

This is a guide to Matlab ezplots. Here we discuss the Introduction, syntax, description, and examples with code implementation of Matlab ezplots. You may also have a look at the following articles to learn more –

  1. MATLAB text()
  2. feval Matlab
  3. MATLAB Toolbox
  4. MATLAB Colon
Primary Sidebar
Footer
Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - 🎁 ENROLL NOW