Help with semiology subplot

57 views (last 30 days)
Ping
Ping on 15 Oct 2012
Instructions: Supposedly within folding the paper in half 45 times, the paper will be so thick that it can reach the moon (and with one more fold, it will reach to the moon and back)! I have to create a function called plot06 that generates a 1x2 matrix of subplots where you plot the thickness of the paper as it grows with each fold. For the left subplot, use the plot function to plot on a linear scale. For the right subplot, use the semilogy function to plot on a semilog scale. For both subplots, add a line that marks the distance from the earth to the moon.
Assume the distance from the earth to the moon is 3.789 e 5 kilometers and the thickness of paper is 1 e-7 kilometers. Start at the first fold, where n = 1 and thickness = 2 e-7. Then, use a for-loop to continue building the an array of the paper’s thickness for 45 folds. Your result should appear similar to the image below.
I'm not too sure on why my plot is not showing up. Is it because I didn't plot the linear scale properly? But, I think I'm confused the most with how to construct the for-loop and whether or not it plays a role in the plot. thanks!
x = 0:.1:10;
subplot(1,2,1);
plot(x,semilogy(x,10.^x));
x = 0:0.1:10;
subplot(1,2,2);
plot(semilogx(10.^x,x))
for i = 1:45: 2 * e ^ -7;
a(i) = i*i;
end

Accepted Answer

Wayne King
Wayne King on 15 Oct 2012
Edited: Wayne King on 15 Oct 2012
semilogy() and semilogx() are plot commands, you do not need to call plot() on them
x = 0:0.1:10;
subplot(1,2,2);
semilogx(10.^x,x)
aslo, it's not e^-7 it's just
1e-7

More Answers (0)

Community Treasure Hunt

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

Start Hunting!