{"id":5643,"date":"2019-12-24T09:20:35","date_gmt":"2019-12-24T14:20:35","guid":{"rendered":"https:\/\/blogs.mathworks.com\/cleve\/?p=5643"},"modified":"2019-12-24T09:20:35","modified_gmt":"2019-12-24T14:20:35","slug":"christmas-greetings-2019","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/cleve\/2019\/12\/24\/christmas-greetings-2019\/","title":{"rendered":"Christmas Greetings 2019"},"content":{"rendered":"<div class=\"content\"><!--introduction--><!--\/introduction--><p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/xmas_2019.gif\" alt=\"\"> <\/p><p>Inspired by Patsy and <a href=\"https:\/\/www.amazon.com\/gp\/product\/B075JDVR53\">https:\/\/www.amazon.com\/gp\/product\/B075JDVR53<\/a>.<\/p><pre class=\"codeinput\">  type <span class=\"string\">xmas_2019.m<\/span>\r\n<\/pre><pre class=\"codeoutput\">\r\nfunction xmas_2019\r\n    % Christmas greetings.\r\n    \r\n    set(gcf,'pos',[800 200 420 315])\r\n    clf\r\n    axis([0 1 0 1])\r\n    axis off\r\n    \r\n    for k = 1:3\r\n        [x,y] = base(k);\r\n        patch(x,y,gray)\r\n        [x,y] = edge(k);\r\n        flame(k) = patch(x,y,'w');\r\n    end\r\n\r\n    gif_frame('html\/xmas_2019.gif')\r\n    for k = 1:50\r\n        r = randi(2,1,3)-1;\r\n        j = randi(3,1,1);\r\n        if norm(r) &gt; 0\r\n            flame(j).FaceColor = r;\r\n            gif_frame\r\n        end\r\n    end\r\n    gif_frame('reset')\r\n    close\r\n    \r\n    function [x,y] = base(k)\r\n        xo = [.33 .45 .57];\r\n        ys = [.38 .30 .44];\r\n        x = xo(k) + .10*[0 1 1 0 0];\r\n        y = ys(k)*[0 0 1 1 0];\r\n    end\r\n\r\n    function [x,y] = edge(k)\r\n        xo = [.33 .45 .57];\r\n        yo = [.38 .30 .44]; \r\n        e = [2 0 0 2 3];\r\n        x = xo(k) + .01*[e 5 10-fliplr(e)];\r\n        y = yo(k) + .08*[0:4 5 4:-1:0];\r\n    end\r\n\r\n    function g = gray\r\n        g = [.5 .5 .5];\r\n    end\r\nend\r\n<\/pre><script language=\"JavaScript\"> <!-- \r\n    function grabCode_7e29b0ef2dc44af4be1e9b82f318b1bb() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='7e29b0ef2dc44af4be1e9b82f318b1bb ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 7e29b0ef2dc44af4be1e9b82f318b1bb';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        copyright = 'Copyright 2019 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add copyright line at the bottom if specified.\r\n        if (copyright.length > 0) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n\r\n        d.title = title + ' (MATLAB code)';\r\n        d.close();\r\n    }   \r\n     --> <\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_7e29b0ef2dc44af4be1e9b82f318b1bb()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n      the MATLAB code <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2018b<br><\/p><\/div><!--\r\n7e29b0ef2dc44af4be1e9b82f318b1bb ##### SOURCE BEGIN #####\r\n%% Christmas Greetings 2019\r\n\r\n%%\r\n%\r\n% <<xmas_2019.gif>>\r\n%\r\n% Inspired by Patsy and\r\n% <https:\/\/www.amazon.com\/gp\/product\/B075JDVR53>.\r\n\r\n  type xmas_2019.m\r\n##### SOURCE END ##### 7e29b0ef2dc44af4be1e9b82f318b1bb\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"http:\/\/blogs.mathworks.com\/cleve\/files\/xmas_2019.gif\" onError=\"this.style.display ='none';\" \/><\/div><p> Inspired by Patsy and https:\/\/www.amazon.com\/gp\/product\/B075JDVR53.  type xmas_2019.m\r\n\r\nfunction xmas_2019\r\n    % Christmas greetings.\r\n    \r\n    set(gcf,'pos',[800 200 420 315])\r\n    clf\r\n   ... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/cleve\/2019\/12\/24\/christmas-greetings-2019\/\">read more >><\/a><\/p>","protected":false},"author":78,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[32,5,23],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/5643"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/users\/78"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/comments?post=5643"}],"version-history":[{"count":1,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/5643\/revisions"}],"predecessor-version":[{"id":5647,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/posts\/5643\/revisions\/5647"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/media?parent=5643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/categories?post=5643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/cleve\/wp-json\/wp\/v2\/tags?post=5643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}