Paulo Silva

What matlab easter eggs do you know?

Paulo Silva on 25 Feb 2011
Latest activity Reply by David Cazenave on 10 May 2024

Please post the easter eggs that you have found so far if they aren't already posted by someone else.
Let's try to make a good Matlab easter egg list because it seems that there isn't one.
What should be posted:
  • Unexpected but intentional behaviour
  • Special things that the programmers left for us to discover
  • Extra code inside a function that can be used for other purposes
  • Hidden pictures and audio clips
What shouldn't be posted:
  • Repeated Easter Eggs, if someone already posted it please don't repeat
  • Bugs in functions that cause trouble and might be fixed in later versions
  • Matlab games that come with the program unless they aren't mentioned in the documentation (the games are in the other demos, try the xpbombs and fifteen, you can even see the code for both games)
David Cazenave
David Cazenave on 10 May 2024
Descartes said 'I think therefore, I am.' For all you 'newton_2x2.m', and 'nfnitcerestst.m' fans, my 'Series Convergence Calculator' script now has a 15 - ball (Abel's Convergence Test - a powerful, advanced, test for converging trigonometric, and all other converging series). Look for it in an all encompassing update, happening soon at a screen near you!!!
Hans Scharler
Hans Scharler on 24 Apr 2024
Aaron Coville
Aaron Coville on 6 May 2024
Since 'why' can be seeded (and has a max input of 2^32), some friends and I ran an exhaustive script to see what the longest response from 'why' is (it took many days to run across several computers). We found why(3282186255) generated a response that's 346 words long! This was using the default (v5uniform) seed generator, but there are several others one could set and check for possibly even longer responses! (This was done on R2023b)
Chen Lin
Chen Lin on 6 May 2024
Wow! It will be cool if you can share the result. Worthy of a seperate post.
Hans Scharler
Hans Scharler on 6 May 2024
That's so cool! Thanks for sharing.
Walter Roberson
Walter Roberson on 24 Apr 2024
Because the rich rich and tall and good system manager suggested it.
Hans Scharler
Hans Scharler on 24 Apr 2024
Petros Bogiatzis
Petros Bogiatzis on 7 Feb 2023
Not sure if this is known,
Michele on 29 Apr 2022
@Walter Roberson thank you :D !
Walter Roberson
Walter Roberson on 29 Apr 2022
toolbox/dsp/dspdemos/audio48.mat (exists at least to R2021b)
Image Analyst
Image Analyst on 29 Apr 2022
@David, audio48 doesn't seem to exist on my R2021b system with my installed toolboxes.
Walter Roberson
Walter Roberson on 28 Apr 2022
eml_asteroids exists in R2020b in
fullfile(matlabroot, 'toolbox', 'stateflow', 'sfdemos')
Also in R2016b. I do not seem to see it in my other installations, but I might not happened to have installed the right product for the other versions.
Michele on 28 Apr 2022
Hi, super nice idea! I am trying the eml_fire or eml_asteroids and I always get an error, also for the sf_tictacflow. I am using MATLAB2022a. Does anyone know why I keep getting this error? Thank you :)
Leo Borcherding
Leo Borcherding on 28 Aug 2019
Leo Borcherding
Leo Borcherding on 28 Aug 2019
This will pull up a Conways Game of Life Cellular simulation
Aneesh on 10 Jul 2014
@David That's absolutely mesmerizing. Thanks!
David Hann
David Hann on 28 Apr 2014
lorenz % (Don't even know, just cool)
It's a lorenz attractor, a type of chaotic system
Dennis Jaheruddin
Dennis Jaheruddin on 27 Nov 2013
Not sure if it is really an easter egg, it is a bit simpler than most others.
The description of this function surprised me:
  • eomfun
Note that it is only found in the help, not in the doc.
Image Analyst
Image Analyst on 27 Nov 2013
Easter eggs come and go. It's not in release R2013a. What version did you verify it in?
Sean de Wolski
Sean de Wolski on 7 May 2013
@David, nice!
David on 7 May 2013
Technically all of these are visible code you can look up and manipulate, so I'm not sure these count as Easter Eggs, but whatever. They're still pretty cool.
Forgot a couple, too.
  1. spy (but this was already mentioned also)
  2. load audio48, sound(signal48kHz, Fs48)
That last one plays some random rock band music
David on 7 May 2013
Ok so here's a list of ones I've found. Some of these ARE Emulators, but I figure most will appreciate them anyway. (A lot of the above posts are random programs associated with emulators and gui's anyway.)
  1. fifteen (Let's you play sliding numbers game)
  2. why (just randomly generated responses)
  3. life (lets you play 'the game of life')
  4. image (that blue pic of the boy)
  5. shower (A program that let's you play with a shower.)
  6. step
  7. surf(membrane)
  8. imagesc(hot)
  9. logo
  10. cruller (3D image and is rotatable)
  11. census
  12. earthmap
  13. eigshow (rotates vectors on screen)
  14. imagesAndVideo (video of space shuttle take off)
  15. imageext (lets you see SEVERAL random images)
  16. knot (Another 3D image that's rotatable)
  17. lorenz (Don't even know, just cool)
  18. makevase
  19. truss (Bending modes of a truss)
  20. vibes (3D vibrating image)
  21. wrldtrv (Let's you plan world travel distances)
  22. xpquad (Changing quadratics of a cube)
  23. xpsound (Sound demo that includes Handel)
  24. eml_asteroids (Asteroids videogame emulator)
  25. eml_fire (Emulator that displays growing fire)
  26. sf_tictacflow (Tictactoe emulator)
  27. rlc_gui (RLC circuit analysis emulator)
  28. tetris_2 (Tetris)
Grady on 24 Apr 2024
Just a warning, my MATLAB says colerdef will be removed in a future release.
Image Analyst
Image Analyst on 26 Jan 2012
Not sure if they qualify as Easter eggs, but type these on the command line (verified on R2011b):
  1. why
  2. why are there too many input arguments?
  3. xpbombs
  4. fifteen
  5. spy (new image is probably only version R2011b or later - clearly Sean has had some influence since he joined the Mathworks staff)
  6. x=[-2:.001:2],y=(sqrt(cos(x)).*cos(200*x)+sqrt(abs(x))-0.7).*(4-x.*x).^0.01,plot(x,y);
On, Cleve says " As our code base has increased, including such goodies in the MATLAB core has become problematic because of the strain it puts on rigorous automated testing. It is still possible to include them in a few “leaf” M functions, like “spy”, that other functions do not depend upon." so they will probably be fewer as time goes on.
Saurav Kumar
Saurav Kumar on 25 Apr 2011
surf(membrane) gives mathworks logo
imagesc(cool) gives the cool colors
Image Analyst
Image Analyst on 26 Jan 2012
So does "logo"
Paulo Silva
Paulo Silva on 5 Mar 2011
Today I found that these functions:
From the Control System Toolbox work without any arguments, there's a sort of demo that they make, very nice, I was using them for years without noticing, nice surprise, wonder why the tf function doesn't also have the same behaviour
Kenneth Eaton
Kenneth Eaton on 25 Feb 2011
As Steve discussed in one of his blog posts, the default image in MATLAB is actually a steganographic image:
Just looks like an upside-down little boy, right? Well, if you rotate the 53-bits of the double precision fraction component so that each becomes the highest valued bit, you can easily see the hidden images:
Here's how I made the above image:
defImage = pow2(get(0,'DefaultImageCData'),47);
imgCell = repmat({zeros(size(defImage))},8,7);
for shift = 0:52
imgCell{shift+1} = bitrotate(defImage,shift);
allImages = cell2mat(imgCell.');
imshow(allImages,[min(allImages(:)) max(allImages(:))]);
NOTE: bitrotate is a version of the built-in bitshift that I wrote to perform a circular shift of the bit pattern instead of discarding bits that overflow. I'll be placing bitrotate on the FEX soon, but for now you can just replace it with bitshift in the above code.
Andrew Newell
Andrew Newell on 25 Feb 2011
What - no image of Satan?
Paulo Silva
Paulo Silva on 25 Feb 2011
Hi Kenneth that's very cool, +1 vote
Andrew Newell
Andrew Newell on 25 Feb 2011
This site and this site have several Easter eggs, but most don't work on 2010b. Just these work for me:
But are these really Easter eggs or just demos?
Sean de Wolski
Sean de Wolski on 25 Feb 2011
Paulo, search Steve Eddin's Blog for 'image function' (or similar). There is quite a lot to learn there!
Paulo Silva
Paulo Silva on 25 Feb 2011
Hi Scott, without being able to see the code for image it's not easy :(
Michelle Hirsch
Michelle Hirsch on 25 Feb 2011
Oh, but there is so much more to image than meets the eye!! Let's see who can find what else is hidden there :)
Paulo Silva
Paulo Silva on 25 Feb 2011
I'm giving you a vote :) and will give the same vote to anyone who post at least another easter egg that wasn't posted before.
Paulo Silva
Paulo Silva on 25 Feb 2011
That's the site where I found the easter eggs I posted, I forgot about the image one but the last time I was there was many years ago.
image is one for sure, it's a function that has the extra feature of doing something unexpected just like the spy one.
penny just shows a penny, nothing more and it's not even a function
shower is a simulink demo, interesting but still a demo like many others
Thank for adding another easter egg, I'm not accepting your answer yet but will soon unless there's another answer with more votes in the next days.
Paulo Silva
Paulo Silva on 25 Feb 2011
unexpected things are also welcome to the list :)
Matt Fig
Matt Fig on 25 Feb 2011
I am unfamiliar with what you mean by "Easter Egg." But if it means an unexpected, nice surprise, then finding out that FINDSTR takes non-string arguments was a nice surprise to me:
I = findstr(round(rand(1,10000)),[1 1 0 0 1 1 0 0])
Paulo Silva
Paulo Silva on 25 Feb 2011
I'm taking advantage of the current problem with the answers system
Matt Fig
Matt Fig on 25 Feb 2011
Paulo Silva
Paulo Silva on 25 Feb 2011
The spy function without arguments makes a cool figure (my current avatar).
The why function says random things.
Matlab comes with a great sound clip for those moments when you find a solution for a huge problem
load handel
The pie function (matlab 2008b and maybe later versions) doesn't allow to place the labels in a specific place but in the function code there's a variable that allows the text to be inside the pie and you might also set the distance from the center of the pie, here's a little hack that I did to pie
Image Analyst
Image Analyst on 26 Jan 2012
Paulo, your avatar is no longer the "spy" image that pops up - it's Sean's dog (I think). Sean's lalala function is not in R2011b - maybe it will come out in R2012a.
Paulo Silva
Paulo Silva on 25 Feb 2011
Hey Sean that's good fun but I wonder if the nice people from mathworks did include something similar but no one found it yet, are they forbid to do that?
Sean de Wolski
Sean de Wolski on 25 Feb 2011
I wrote two functions:
and lalala.m
lala displays: "stop singing and get back to work"
and lalala sounds handel. It makes for fun giving those to others in the lab.
Andrew Newell
Andrew Newell on 25 Feb 2011
It's a MAD world!
Paulo Silva
Paulo Silva on 25 Feb 2011
I've been using the spy function without arguments for years, found it while looking for matlab easter eggs on google, every GUI I made so far for some classes had at least one axes (or axis?!) and guess what, when the user open the GUI it will see the spy as the default picture.
So the easter egg came first and I find it cool, even here he looks good, always looking at my messages :)
Andrew Newell
Andrew Newell on 25 Feb 2011
Which can first, the spy Easter egg or your choice of an avatar?

See Also