Problem using the subplot command
Ältere Kommentare anzeigen
Hello, I want to plot 3 graphs in a single figure. I want to use the subplot command. However, I am unable to plot the graph vertically.
eg:
x = 0:5;
y = sin(x);
z = log(y);
subplot(2,2,1:3), plot(x,y)
subplot(2,2,2), plot(y,z)
subplot(2,2,4), plot(x,z)
This code does not work properly.
However, if I try to plot the graph horizontally, it works very well
eg:
x = 0:5;
y = sin(x);
z = log(y);
subplot(2,2,1:2), plot(x,y)
subplot(2,2,3), plot(y,z)
subplot(2,2,4), plot(x,z)
why is this so ? How can I plot vertically ?
Harshal
Akzeptierte Antwort
Weitere Antworten (1)
Abioye Samson
am 17 Aug. 2012
0 Stimmen
you can write it this way Subplot(m,,n,p)
so far you want to plot 3 figure vertically on the same figure that means m which is the row=1 n which is the column=3 while p is going to be=1,2,or 3.
code codes below
subplot(1,3,1)% first graph left
plot(x,y)
subplot(1,3,2)% second graph middle
plot(y,z)
subplot(1,3,3)%third graph right
plot(x,z)
Kategorien
Mehr zu Subplots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!