Can I plot semilogx, semilogy, loglog plots simultaneously by writing in code in a single m file?

13 views (last 30 days)
I have the following code in an m file :
x = linspace(0,10);
y=x.^3;
semilogx(x,y);
semilogy(x,y);
loglog(x,y);
This gives the last plot only. How do I get the rest of the plots?

Accepted Answer

Stephen23
Stephen23 on 30 Jan 2016
Edited: Stephen23 on 30 Jan 2016
You could use figure to create three separate figures:
x = linspace(0,10);
y=x.^3;
figure()
semilogx(x,y);
figure()
semilogy(x,y);
figure()
loglog(x,y);
Or alternatively three subplots on one figure using subplot:
figure()
subplot(2,2,1)
semilogx(x,y);
subplot(2,2,2)
semilogy(x,y);
subplot(2,2,3)
loglog(x,y);

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!