MATLAB Answers

Create Plot Title of the Plotted Function

3 views (last 30 days)
How can I make the title of a plot the function I am plotting?
Here is the code trying to use:
x = 0:.01:1;
for i= 1:9
subplot(3,3,i)
y = x.^i;
plot(x, y, 'black')
xlabel('x')
ylabel('y')
% title()???
end

  0 Comments

Sign in to comment.

Accepted Answer

Bhaskar R
Bhaskar R on 8 Apr 2020
x = 0:.01:1;
for i= 1:9
subplot(3,3,i)
y = x.^i;
plot(x, y, 'black')
xlabel('x')
ylabel('y')
title(['Title\_' sprintf('%d', i)])
end

  1 Comment

Forrest Graham
Forrest Graham on 8 Apr 2020
Thank you! I was able to display the exponential function as the title for each subplot using this. :)

Sign in to comment.

More Answers (0)


Translated by