How to created plot with three lines
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I need to create a plot with three lines displayed on a single plot. I understand how to make three plots with the correct data but I need them on the same plot.
This is the format we use in my class to do so.
figure subplot(1,2,1) title () xlabel() ylabel()
This creates multiple plots. I know there is a way to make only a single plot but I cannot figure it out. Also, is there a way for me to enter a textbox that I can put an analysis of the plot in my figure?
0 Kommentare
Antworten (1)
Star Strider
am 15 Feb. 2015
I would use the hold function to put all the plots on the same axis. The other function you want is legend:
x = linspace(-5, 5);
y1=x.^2;
y2=-5*x+2 ;
y3=4*ones(size(x));
figure(1)
plot(x, y1)
hold on
plot(x, y2)
plot(x, y3)
hold off
grid
legend('y_1', 'y_2', 'y_3', 'Location', 'SW')
0 Kommentare
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!