image thumbnail

MATLAB Plot Gallery - Function Plot (1)

by

 

24 Feb 2012 (Updated )

Create a line plot from a function

Function_Plot_1

This is an example of how to create an line plot from a function in MATLAB®.

Read about the ezplot function in the MATLAB documentation.

For more examples, go to MATLAB Plot Gallery

% Create the plot using the lemniscate function f(x,y) = (x^2 + y^2)^2 - x^2 + y^2
figure
ezplot('(x^2 + y^2)^2 - x^2 + y^2', [-1.1, 1.1], [-1.1, 1.1])

% Adjust the colormap to plot the function in blue
colormap([0 0 1])

% Add a multi-line title
title({'Lemniscate Function', '(x^2 + y^2)^2 - x^2 + y^2'})

Contact us