{"id":102,"date":"2008-12-27T23:02:46","date_gmt":"2008-12-27T22:02:46","guid":{"rendered":"http:\/\/www.walkingrandomly.com\/?p=102"},"modified":"2008-12-27T23:03:18","modified_gmt":"2008-12-27T22:03:18","slug":"a-matlab-christmas-card","status":"publish","type":"post","link":"https:\/\/walkingrandomly.com\/?p=102","title":{"rendered":"A MATLAB Christmas card"},"content":{"rendered":"<p>The guys at <a href=\"http:\/\/blinkdagger.com\/\">Blinkdagger<\/a> put together a great MATLAB Christmas card for you all and sent it in to me as part of the Walking Randomly <a href=\"https:\/\/www.walkingrandomly.com\/?p=395\">Christmas challenge<\/a>.\u00a0 I would have posted it earlier but I have been away from the Internet over Christmas (sorry Rob).  Thanks guys!<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"aligncenter\" src=\"\/images\/matlab\/matlab_card08.jpg\" alt=\"MATLAB Christmas card\" \/><\/p>\n<p>A brief explanation of the maths involved (from Rob of Blinkdagger)<br \/>\n&#8211; the snowdrifts are sine waves of different amplitudes and offsets<br \/>\n&#8211; the tree is a 3D spiral of green asterisks<br \/>\n&#8211; the ornaments are a random selection of the same points as the tree,<br \/>\nwith different colors and marker types<br \/>\n&#8211; the presents under the tree are the trademark &#8220;membrane&#8221; surface that is the MATLAB logo.<br \/>\n&#8211; the star atop the tree, as well as the star in the sky are just single points graphed, but using the default marker types creatively<br \/>\n&#8211; the text is, well it&#8217;s just text<\/p>\n<p><code><br \/>\n% Xmas card from blinkdagger.com for the challenge<\/code><\/p>\n<p>%% setup the fig<br \/>\nh1 = figure(&#8216;Position&#8217;,[50 50 800 600],&#8217;Color&#8217;,&#8217;w&#8217;);<\/p>\n<p>%% Put background snowdrifts and star<br \/>\naxes(&#8216;Position&#8217;,[0 0.5 1 .05]);<br \/>\nezplot(&#8216;sin(.1*x+1.8)&#8217;); axis off; title(&#8221;);<\/p>\n<p>axes(&#8216;Position&#8217;,[0 0.4 1 .1]);<br \/>\nezplot(&#8216;sin(.3*x)&#8217;); axis off; title(&#8221;);<\/p>\n<p>axes(&#8216;Position&#8217;,[0 0.25 1 .1]);<br \/>\nezplot(&#8216;sin(.4*x-1.5)&#8217;); axis off; title(&#8221;);<\/p>\n<p>axes(&#8216;Position&#8217;,[0 0.1 1 .15]);<br \/>\nezplot(&#8216;cos(.4*x-2)&#8217;); axis off; title(&#8221;);<\/p>\n<p>axes(&#8216;Position&#8217;,[0.75 0.75 0.2 0.2]);<br \/>\nplot(1,1,&#8217;x&#8217;,&#8217;markersize&#8217;,48,&#8217;markeredgecolor&#8217;,[.5 .5 .5]);<br \/>\naxis off; title(&#8221;); hold on;<br \/>\nplot(1,1,&#8217;h&#8217;,&#8217;markersize&#8217;,36,&#8217;markeredgecolor&#8217;,[.5 .5 .5]);<br \/>\nplot(1,1,&#8217;+&#8217;,&#8217;markersize&#8217;,80,&#8217;markeredgecolor&#8217;,[.5 .5 .5]);<br \/>\nhold off;<\/p>\n<p>%% Put tree on and decorate it<\/p>\n<p>axes(&#8216;Position&#8217;,[0.55 0.2 0.4 0.6]);<br \/>\nz = 0:.05:100;<br \/>\nx = cos(z); x = (101-z).*x;<br \/>\ny = sin(z); y = (101-z).*y;<br \/>\nplot3(x,y,z,&#8217;g*&#8217;,&#8217;markersize&#8217;,18); axis off; view(0,10);<br \/>\nhold all;<br \/>\n% star on top<br \/>\nplot3(0,0,107,&#8217;p&#8217;,&#8217;markersize&#8217;,24,&#8217;markerfacecolor&#8217;,[1 .8431 0],&#8230;<br \/>\n&#8216;markeredgecolor&#8217;,&#8217;r&#8217;);<br \/>\n% plot ornaments<br \/>\nk = rand(size(x));<br \/>\nk1 = k&gt;.97;<br \/>\nk2 = k&gt;.94 &amp; k&lt;.97;<br \/>\nk3 = k&gt;.91 &amp; k&lt;.94;<br \/>\nk4 = k&gt;.88 &amp; k&lt;.91;<br \/>\nk5 = k&gt;.85 &amp; k&lt;.88;<br \/>\nk6 = k&gt;.82 &amp; k&lt;.85;<br \/>\nplot3(x(k1),y(k1),z(k1),&#8217;ro&#8217;,&#8217;markersize&#8217;,8,&#8217;linewidth&#8217;,2); axis off; view(0,10);<br \/>\nplot3(x(k2),y(k2),z(k2),&#8217;ys&#8217;,&#8217;markersize&#8217;,8,&#8217;linewidth&#8217;,2); axis off; view(0,10);<br \/>\nplot3(x(k3),y(k3),z(k3),&#8217;md&#8217;,&#8217;markersize&#8217;,8,&#8217;linewidth&#8217;,2); axis off; view(0,10);<br \/>\nplot3(x(k4),y(k4),z(k4),&#8217;b^&#8217;,&#8217;markersize&#8217;,8,&#8217;linewidth&#8217;,2); axis off; view(0,10);<br \/>\nplot3(x(k5),y(k5),z(k5),&#8217;kh&#8217;,&#8217;markersize&#8217;,8,&#8217;linewidth&#8217;,2); axis off; view(0,10);<br \/>\nplot3(x(k6),y(k6),z(k6),&#8217;c*&#8217;,&#8217;markersize&#8217;,8,&#8217;linewidth&#8217;,2); axis off; view(0,10);<\/p>\n<p>hold off;<\/p>\n<p>%% Put presents under the tree<br \/>\naxes(&#8216;Position&#8217;,[0.5 0.12 0.1 0.15]);<br \/>\ncolormap(hot*.7); surf(membrane,membrane); shading flat; axis off; view(300,20);<br \/>\naxes(&#8216;Position&#8217;,[0.57 0.1 0.1 0.15]);<br \/>\nsurf(membrane); shading flat; axis off; view(300,20);<br \/>\naxes(&#8216;Position&#8217;,[0.63 0.08 0.1 0.15]);<br \/>\nsurf(membrane); shading flat; axis off; view(300,20);<br \/>\naxes(&#8216;Position&#8217;,[0.7 0.08 0.1 0.15]);<br \/>\nsurf(membrane); shading flat; axis off; view(300,20);<br \/>\naxes(&#8216;Position&#8217;,[0.77 0.1 0.1 0.15]);<br \/>\nsurf(membrane); shading flat; axis off; view(300,20);<br \/>\naxes(&#8216;Position&#8217;,[0.83 0.13 0.1 0.15]);<br \/>\nsurf(membrane); shading flat; axis off; view(300,20);<\/p>\n<p>%% Overlay snowflakes<\/p>\n<p>%% Text greeting<\/p>\n<p>axes(&#8216;Position&#8217;,[.05 .6 .5 .5]); axis off;<br \/>\ntext(.08,.55,&#8217;Seasons Greetings!&#8217;,&#8217;fontsize&#8217;,30,&#8217;color&#8217;,&#8217;r&#8217;,&#8230;<br \/>\n&#8216;fontname&#8217;,&#8217;Garamond&#8217;,&#8217;fontweight&#8217;,&#8217;bold&#8217;);<br \/>\ntext(.07,.31,&#8217;Best wishes and have a great 2009&#8242;,&#8217;fontsize&#8217;,20,&#8230;<br \/>\n&#8216;color&#8217;,[0 .4 0],&#8217;fontname&#8217;,&#8217;Garamond&#8217;);<br \/>\ntext(.07,.18,&#8217;solving problems with MATLAB!&#8217;,&#8217;fontsize&#8217;,20,&#8230;<br \/>\n&#8216;color&#8217;,[0 .4 0],&#8217;fontname&#8217;,&#8217;Garamond&#8217;);<br \/>\ntext(.07,.05,&#8217;From everyone at blinkdagger.com!&#8217;,&#8217;fontsize&#8217;,20,&#8230;<br \/>\n&#8216;color&#8217;,[0 .4 0],&#8217;fontname&#8217;,&#8217;Garamond&#8217;);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The guys at Blinkdagger put together a great MATLAB Christmas card for you all and sent it in to me as part of the Walking Randomly Christmas challenge.\u00a0 I would have posted it earlier but I have been away from the Internet over Christmas (sorry Rob). Thanks guys! A brief explanation of the maths involved [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[11],"tags":[],"class_list":["post-102","post","type-post","status-publish","format-standard","hentry","category-matlab"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3swhs-1E","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=102"}],"version-history":[{"count":5,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/102\/revisions"}],"predecessor-version":[{"id":481,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=\/wp\/v2\/posts\/102\/revisions\/481"}],"wp:attachment":[{"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/walkingrandomly.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}