MATLAB Magic Contour

Yesterday, I has doing my thesis and was thinking of a way to plot vorticity by using contourf command in MATLAB. Because it has been a while since I use contourf command, I tried to refresh my mind about the syntax of this command. So I decided to generate a random array using magic command and plot the array in contour plot. I did this for several times by varying the array size generated by magic command an it turns out that several patterns emerged when contourf and magic command are used together.

When I see this, I quickly drifted away from doing my thesis (and that’s why I’m slow in doing my thesis:D) and explore this ‘magic contour’ thing. I notice that by using contourf(magic(n)) command and replacing n with an arbitrary number, a cool (or maybe not) pattern appear in the resulting contour plot. I tried to explore how type of pattern that can be made, so I did try using n from 1 to 75 (and wasted 10minutes not doing my thesis) and see all the contour that MATLAB generated. Here is several contour that has cool (or maybe not) pattern that I found:D.

Plot of contourf(magic(3))

Plot of contourf(magic(7))

Plot of contourf(magic(17))

Plot of contourf(magic(48))

Plot of contourf(magic(66))

Plot of contourf(magic(73))

All plot above are created simply by using contourf(magic(3)) command. If you are trying to vary the integer for n, you will notice that the patterns were repeated. These six patterns above were the one that I think is quite cool (or maybe not), that’s why I’m sharing them here. Try it for yourself. It’s fun at least (for a stressed-out person like me:D)…



This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s