{"id":4531,"date":"2015-04-01T00:01:10","date_gmt":"2015-04-01T05:01:10","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/?p=4531"},"modified":"2015-03-31T19:00:57","modified_gmt":"2015-04-01T00:00:57","slug":"simulink-easter-eggs","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2015\/04\/01\/simulink-easter-eggs\/","title":{"rendered":"Simulink Easter Eggs"},"content":{"rendered":"<p>With Easter just a few days away, we thought it was a good time to share some little known Easter eggs that exist in Simulink.<\/p>\r\n\r\n<p><b>Philosophical Annotations<\/b><\/p>\r\n<p>Many MATLAB users are aware of the interesting response you can get by typing WHY in the command prompt. But, did you know that Simulink Annotations offer similar behavior? Fans of a <a href=\"http:\/\/en.wikipedia.org\/wiki\/The_Hitchhiker%27s_Guide_to_the_Galaxy\">certain science fiction series<\/a> might appreciate this one.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2015Q1\/FortyTwo.gif\" alt=\"42\" \/><\/p>\r\n\r\n<p><b>Appreciation for Irrational Numbers that are Homophones for Baked Goods<\/b><\/p>\r\n<p>We have a deep appreciation for pi (and for pie). I was recently told that if you string enough of the digits of pi in a series of gain blocks, you could achieve some interesting results. That sounded like a lot of work, so I wrote a script using add_block to construct the model. In the end, the result was definitely interesting.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2015Q1\/PiModel.gif\" alt=\"Yum\" \/><\/p>\r\n<p><!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01 Transitional\/\/EN\"><html><head>\r\n      <meta http-equiv=\"Content-Type\" content=\"text\/html; charset=utf-8\">\r\n   <!--\r\nThis HTML was auto-generated from MATLAB code.\r\nTo make changes, update the MATLAB code and republish this document.\r\n      --><title>buildPiModel<\/title><meta name=\"generator\" content=\"MATLAB 8.5\"><link rel=\"schema.DC\" href=\"http:\/\/purl.org\/dc\/elements\/1.1\/\"><meta name=\"DC.date\" content=\"2015-03-30\"><meta name=\"DC.source\" content=\"buildPiModel.m\"><style type=\"text\/css\">\r\nhtml,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}\r\n\r\nhtml { min-height:100%; margin-bottom:1px; }\r\nhtml body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }\r\nhtml body td { vertical-align:top; text-align:left; }\r\n\r\nh1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }\r\nh2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }\r\nh3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }\r\n\r\na { color:#005fce; text-decoration:none; }\r\na:hover { color:#005fce; text-decoration:underline; }\r\na:visited { color:#004aa0; text-decoration:none; }\r\n\r\np { padding:0px; margin:0px 0px 20px; }\r\nimg { padding:0px; margin:0px 0px 20px; border:none; }\r\np img, pre img, tt img, li img, h1 img, h2 img { margin-bottom:0px; } \r\n\r\nul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }\r\nul li { padding:0px; margin:0px 0px 7px 0px; }\r\nul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }\r\nul li ol li { list-style:decimal; }\r\nol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }\r\nol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }\r\nol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }\r\nol li ol li { list-style-type:lower-alpha; }\r\nol li ul { padding-top:7px; }\r\nol li ul li { list-style:square; }\r\n\r\n.content { font-size:1.2em; line-height:140%; padding: 20px; }\r\n\r\npre, code { font-size:12px; }\r\ntt { font-size: 1.2em; }\r\npre { margin:0px 0px 20px; }\r\npre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }\r\npre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }\r\npre.error { color:red; }\r\n\r\n@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }\r\n\r\nspan.keyword { color:#0000FF }\r\nspan.comment { color:#228B22 }\r\nspan.string { color:#A020F0 }\r\nspan.untermstring { color:#B20000 }\r\nspan.syscmd { color:#B28C00 }\r\n\r\n.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }\r\n.footer p { margin:0px; }\r\n.footer a { color:#878787; }\r\n.footer a:hover { color:#878787; text-decoration:underline; }\r\n.footer a:visited { color:#878787; }\r\n\r\ntable th { padding:7px 5px; text-align:left; vertical-align:middle; border: 1px solid #d6d4d4; font-weight:bold; }\r\ntable td { padding:7px 5px; text-align:left; vertical-align:top; border:1px solid #d6d4d4; }\r\n\r\n  <\/style><\/head><body><div class=\"content\"><pre class=\"codeinput\"><span class=\"comment\">% Initialize based on current selected block<\/span>\r\nlastBlock = get_param(gcb,<span class=\"string\">'Name'<\/span>);\r\nblockPos = get_param(gcb,<span class=\"string\">'Position'<\/span>);\r\n\r\n<span class=\"keyword\">for<\/span> ii = 1:100\r\n    <span class=\"comment\">% Calculate next digit of pi<\/span>\r\n    lastDigit = rem(floor(pi*power(10,ii-1)),10);\r\n\r\n    <span class=\"comment\">% Generate a new block<\/span>\r\n    blockPos = blockPos+[50 0 50 0];\r\n    newBlock = sprintf(<span class=\"string\">'Gain%d'<\/span>,ii);\r\n    newGain = add_block(<span class=\"string\">'built-in\/Gain'<\/span>,[gcs,<span class=\"string\">'\/'<\/span>,newBlock],<span class=\"string\">'Position'<\/span>,blockPos);\r\n\r\n    <span class=\"comment\">% Populate value and connect<\/span>\r\n    set_param(newGain,<span class=\"string\">'Gain'<\/span>,num2str(lastDigit))\r\n    add_line(gcs,[lastBlock,<span class=\"string\">'\/1'<\/span>],[newBlock,<span class=\"string\">'\/1'<\/span>])\r\n    lastBlock = newBlock;\r\n<span class=\"keyword\">end<\/span>\r\n<\/pre><\/body><\/html><\/p>\r\n\r\n<p><b>Little-known Support Package<\/b><\/p>\r\n<p>There are many Support Packages available through the Add-Ons button in the MATLAB toolstrip. Some users have stumbled upon the Advanced Support Package. We can\u2019t reveal the installation steps, but you can see it in action below.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2015Q1\/GuySupport_mouse.gif\" alt=\"Bonjour!\" \/><\/p>\r\n\r\n<p><b>Wait, What Day is it Today?<\/b><\/p>\r\n<p>When you save your Simulink model, the time and date are stored in the Model Properties. Did you also know that on certain dates, an additional comment gets added to the Model History? For example, here\u2019s what you might see if you saved your model today, April 1st.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2015Q1\/AprilFoolsDate.gif\" alt=\"April Fools!\" \/><\/p>\r\n\r\n<p><b>Now It's Your Turn<\/b><\/p>\r\n<p>What are the best April Fools jokes you've played using Simulink?<\/p>\r\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2015Q1\/AprilFoolsDate.gif\" onError=\"this.style.display ='none';\" \/><\/div><p>With Easter just a few days away, we thought it was a good time to share some little known Easter eggs that exist in Simulink.\r\n\r\nPhilosophical Annotations\r\nMany MATLAB users are aware of the... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2015\/04\/01\/simulink-easter-eggs\/\">read more >><\/a><\/p>","protected":false},"author":88,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[71],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4531"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/users\/88"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=4531"}],"version-history":[{"count":10,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4531\/revisions"}],"predecessor-version":[{"id":4546,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4531\/revisions\/4546"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=4531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=4531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=4531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}