How to have multiple plots in one figure
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
So, my issue is the following. Let's imagine that initially i want to run the following code:
RA = 10;
gam = 5;
maxit = 500;
for it = 1: maxit
x = .....
end
y = constant
plot (x,y)
But now, I want to do the same for RA = 5, and have both plots in the same figure. What statement can I use to achive this?
My feeling is that something like
i = [ 10 5]
for i = 1:2
if i == 1
x1 = ....
else
x2 = .....
end
end
plot(x1,y,x2,y)
Does it make sense?
1 comentario
Mathieu NOE
el 28 de Sept. de 2021
hi
whatever code you are producing , you can always plot the results like plot(x,y) , or plot(x1,y1,x2,y2) or even more data , but each pair of x and y values must have same length. for example it works with x1,y1 having length = 100 and x2,y2 having length = 300 (or whatever)
Respuestas (1)
Image Analyst
el 28 de Sept. de 2021
To have a layout/grid of axes on a figure, use subplot().
To draw a contant line at some y value, use yline().
0 comentarios
Ver también
Categorías
Más información sobre Title en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!