This week being a holiday week in the US, and start of winter in the Northern Hemisphere where our corner of the world (Natick, Massachusetts) is located, I figured I would pick something a little more fun and winter related, like a snowflake!
The “Koch Snowflake” or “Koch Star” is a well-known fractal curve (actually one of the earliest fractals to be described). There are many places on the web where you can read about the Koch Snowflake:
The mathematical formula for the Koch snowflake isn't very complicated, and there are at least a half-dozen Koch-related submissions I found on File Exchange. I picked this particular one out of the bunch because it worked straight out of the box, and it has a simple user interface that makes generating a snowflake as easy as entering an integer and pressing a button! Be warned, though, for any iteration order above 6 or 7, it will take a while to generate your snowflake! A close runner-up for me was this submission:
This gives you more fractal functions, and the code is perhaps a bit more polished, but it's not as easy as a graphical user interface with a push button!
Happy winter, everyone!
As always, your thoughts and comments here are greatly appreciated.
Get the MATLAB code
Published with MATLAB® R2015a
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.