How to Set Figure Name in MATLAB
Ammar Ali
Feb 02, 2024
In this tutorial, we will discuss how to give a name and title to a figure using the figure()
function in MATLAB.
Give a Name and Title to a Figure Using the figure()
Function in MATLAB
If you want to plot data on a figure and give the figure a name and title, you can use the figure()
function. You need to use the Name
property of the figure()
function to define its name. For example, let’s plot variables on a figure and give it a name and title. See the code below.
t = 1:0.01:2;
x1 = sin(2*pi*t);
figure('Name' , 'Title of the figure')
plot(t,x1)
Output:
In the above code, we have plotted a sine wave in a figure with a title. You can change the position of the figure using the Position
property, and you can change the units of the figure using the Units
property. Check this link for more details about the figure()
function.
Author: Ammar Ali