Easter eggs as Matlab code

10 views (last 30 days)
Jan on 18 Mar 2013
Dear Matlab community,
Unfortunately I ran out of eggs. I've looked in the FileExchange and found christmas trees, valentine hearts, fireworks and a surprisingly large number of arrows and progressbars. But unfortunately no eggs, most of all no beautiful easter eggs.
I'd be very glad if you could provide some colored eggs as Matlab code.
Please vote all nice solutions.
Jan on 18 Mar 2013
@Leah: Text and sound is welcome also, when an ovate shape can be recognized. The more beautiful, the better.
Of course I will show, what I have done so far also.

Sign in to comment.

Accepted Answer

Daniel Shub
Daniel Shub on 18 Mar 2013
As inspiration you might want to check out how to make eggs in LaTeX. I used that as my starting point. I was thinking about an answer where I just hack tex.m to include the code, but I think TikZ requires PDF output and not DVI and I am not sure tex.m can handle pdf output.
The LaTeX answers provide a link to the shape of an egg. That is enough to get started
t = -pi:0.01:pi;
H = 1;
x = H*0.78.*cos(t./4).*sin(t);
y = -H*cos(t);
fill(x, y, [1, 0.87, 0.68])
axis square
axis([-1, 1, -1, 1]);
axis off
The next step would be to make it 3D, and then play with color, lighting/shading and texture. It is a start ...

More Answers (3)

Leah on 18 Mar 2013
Okay here is my egg so far. I would like to have a fancy color map, but I thought others might like to make one. I used Dan's post (link below), his are very fancy
axis equal
axis off

Sean de Wolski
Sean de Wolski on 18 Mar 2013
Thanks for the Monday challenger.
[x,y,z] = sphere(100);
x = 1.7./(1-0.4*x);
h = surf(x,y,z);
cdata = imresize(imread('onion.png'),size(x));

Image Analyst
Image Analyst on 18 Mar 2013
At first I thought you meant that they took the Easter eggs (like spy, why, penny, etc.) out of the new version of MATLAB. But then I figured out you actually want code to draw pictures of fancy design Easter eggs. I don't have any code for that. I wish they'd refresh their Easter eggs - they're getting kind of stale.
I do have some nice puzzler codes though. One to solve a maze, and another that does a Monte Carlo simulation on the Monty Hall problem, which I haven't posted anywhere, but I could if anyone is interested.
Here's one I ran across that was kind of fun because it's counter-intuitive (though it's really easy to solve): "You have 100 pounds of Martian potatoes, which are 99 percent water by weight. You let them dehydrate until they’re 98 percent water. How much do they weigh now?"
  1 Comment
Jan on 18 Mar 2013
Let me reformat your text a little bit:
have 100
pounds of Martian
potatoes, which are
99 percent water by
weight. You let them
dehydrate until they
are 98 percent water.
How much do they
they weigh

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by