Drawing a sphere inside a sphere?

Is it possible to draw a sphere inside a sphere? I tried the following, but this covers the small sphere, despite the "mesh" instead of "surf":
[x,y,z] = sphere();
r = 5;
mesh( r*x, r*y, r*z );
hold on
r = 2;
mesh( r*x, r*y, r*z );
hold off

 Accepted Answer

You can add
alpha(0.5)
after you plot the first one.

3 Comments

Excellent thank you
Sorry, i'm new to Matlab. I have a question. What is "alpha" for?
It’s the patch transparency parameter, now called FaceAlpha.

Sign in to comment.

More Answers (1)

Another possible solution is to simply add
hidden off
to the very end of your code.

Tags

Asked:

on 25 Jul 2012

Commented:

on 16 May 2021

Community Treasure Hunt

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

Start Hunting!