{"id":8181,"date":"2016-12-09T09:00:10","date_gmt":"2016-12-09T14:00:10","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=8181"},"modified":"2016-12-06T09:47:19","modified_gmt":"2016-12-06T14:47:19","slug":"hour-glass","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2016\/12\/09\/hour-glass\/","title":{"rendered":"Hour Glass"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\n   <introduction><\/p>\n<p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3208495\">Sean<\/a>&#8216;s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/60580-hourglass-time-\"><tt>hourglass<\/tt><\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/5437608\">Tillmann Stuebler<\/a>.\n      <\/p>\n<p>   <\/introduction><\/p>\n<p>Do you ever present with MATLAB?  As an application engineer, this is a core part of my job.  However, even with as exciting<br \/>\n      as MATLAB is, we still need to take breaks occasionally.  Usually, I&#8217;ve either used <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/9671-3d-clock-with-geartrain\">Mike&#8217;s mechanical clock<\/a> or the Sysinternals tool ZoomIt which has a timer to show on the screen during the break.\n   <\/p>\n<p>But lo and behold those are now obsolete with Tillman&#8217;s hour glass!  He uses <a href=\"https:\/\/www.mathworks.com\/help\/matlab\/ref\/ode45.html\"><tt>ode45<\/tt><\/a> to solve for the positions and velocities of sand falling through a glass timer.  The animation runs indefinitely until you close the figure.\n   <\/p>\n<p>Here&#8217;s a screen shot of it running; I won&#8217;t give away the whole animation.<\/p>\n<p><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainhourglass\/hourglass.png\"> <\/p>\n<p><b>Note<\/b> I turned off some of the figure decorations by modifying line 137:\n   <\/p>\n<pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\">fig=figure(<span style=\"color: #A020F0\">'Name'<\/span>,<span style=\"color: #A020F0\">'Hour Glass'<\/span>,<span style=\"color: #A020F0\">'color'<\/span>,<span style=\"color: #A020F0\">'k'<\/span>,<span style=\"color: #A020F0\">'MenuBar'<\/span>,<span style=\"color: #A020F0\">'none'<\/span>,<span style=\"color: #A020F0\">'ToolBar'<\/span>,<span style=\"color: #A020F0\">'none'<\/span>,<span style=\"color: #A020F0\">'NumberTitle'<\/span>,<span style=\"color: #A020F0\">'off'<\/span>);<\/pre>\n<p>My only request for this would be an option to have it run for a certain amount of time like a real hour glass, perhaps just<br \/>\n      by pausing between time steps.\n   <\/p>\n<h3>Comments<a name=\"2\"><\/a><\/h3>\n<p>Give it a try and let us know what you think <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=8181#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/60580-hourglass-time-#comments\">comment<\/a> for Tillmann.\n   <\/p>\n<p><script language=\"JavaScript\">\n<!--\n\n    function grabCode_f69fa840ec4a41058e511e07946fd60b() {\n        \/\/ Remember the title so we can use it in the new page\n        title = document.title;\n\n        \/\/ Break up these strings so that their presence\n        \/\/ in the Javascript doesn't mess up the search for\n        \/\/ the MATLAB code.\n        t1='f69fa840ec4a41058e511e07946fd60b ' + '##### ' + 'SOURCE BEGIN' + ' #####';\n        t2='##### ' + 'SOURCE END' + ' #####' + ' f69fa840ec4a41058e511e07946fd60b';\n    \n        b=document.getElementsByTagName('body')[0];\n        i1=b.innerHTML.indexOf(t1)+t1.length;\n        i2=b.innerHTML.indexOf(t2);\n \n        code_string = b.innerHTML.substring(i1, i2);\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\n\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \n        \/\/ in the XML parser.\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\n        \/\/ doesn't go ahead and substitute the less-than character. \n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\n\n        author = 'Sean de Wolski';\n        copyright = 'Copyright 2016 The MathWorks, Inc.';\n\n        w = window.open();\n        d = w.document;\n        d.write('\n\n<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\n\n\\n');\n      \n      d.title = title + ' (MATLAB code)';\n      d.close();\n      }   \n      \n-->\n<\/script><\/p>\n<p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><a href=\"javascript:grabCode_f69fa840ec4a41058e511e07946fd60b()\"><span style=\"font-size: x-small;        font-style: italic;\">Get<br \/>\n            the MATLAB code<br \/>\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><\/p>\n<p>      Published with MATLAB&reg; R2016b<\/p>\n<\/div>\n<p><!--\nf69fa840ec4a41058e511e07946fd60b ##### SOURCE BEGIN #####\n%% Hour Glass\n%\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/3208495 Sean>'s pick this week is\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/60580-hourglass-time- |hourglass|> by\n% <https:\/\/www.mathworks.com\/matlabcentral\/profile\/authors\/5437608 Tillmann Stuebler>.\n% \n\n%% \n% Do you ever present with MATLAB?  As an application engineer, this is a\n% core part of my job.  However, even with as exciting as MATLAB is, we\n% still need to take breaks occasionally.  Usually, I've either used\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/9671-3d-clock-with-geartrain Mike's\n% mechanical clock> or the Sysinternals tool ZoomIt which has a timer to\n% show on the screen during the break.\n%\n% But lo and behold those are now obsolete with Tillman's hour glass!  He\n% uses <https:\/\/www.mathworks.com\/help\/matlab\/ref\/ode45.html |ode45|> to\n% solve for the positions and velocities of sand falling through a glass\n% timer.  The animation runs indefinitely until you close the figure.\n%\n% Here's a screen shot of it running; I won't give away the whole\n% animation.\n%\n% <<hourglass.png>>\n%\n% *Note* I turned off some of the figure decorations by modifying line 137:\n%\n%   fig=figure('Name','Hour Glass','color','k','MenuBar','none','ToolBar','none','NumberTitle','off');\n%\n% My only request for this would be an option to have it run for a certain\n% amount of time like a real hour glass, perhaps just by pausing between\n% time steps.\n\n%% Comments\n% \n% Give it a try and let us know what you think\n% <https:\/\/blogs.mathworks.com\/pick\/?p=8181#respond here> or leave a\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/60580-hourglass-time-#comments\n% comment> for Tillmann.\n \n\n##### SOURCE END ##### f69fa840ec4a41058e511e07946fd60b\n--><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainhourglass\/hourglass.png\" onError=\"this.style.display ='none';\" \/><\/div>\n<p>Sean&#8216;s pick this week is hourglass by Tillmann Stuebler.<\/p>\n<p>Do you ever present with MATLAB?  As an application engineer, this is a core part of my job.  However, even with as&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2016\/12\/09\/hour-glass\/\">read more >><\/a><\/p>\n","protected":false},"author":87,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,16],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8181"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/users\/87"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/comments?post=8181"}],"version-history":[{"count":3,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8181\/revisions"}],"predecessor-version":[{"id":8184,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/8181\/revisions\/8184"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=8181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=8181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=8181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}