{"id":4231,"date":"2014-10-15T08:16:13","date_gmt":"2014-10-15T13:16:13","guid":{"rendered":"https:\/\/blogs.mathworks.com\/seth\/?p=4231"},"modified":"2014-10-15T14:02:12","modified_gmt":"2014-10-15T19:02:12","slug":"special-vintage-differential-equation-editor","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/simulink\/2014\/10\/15\/special-vintage-differential-equation-editor\/","title":{"rendered":"Special Vintage: Differential Equation Editor"},"content":{"rendered":"<p>This week I feel like an archaeologist who just dug out a new species of dinosaur! I discovered the Differential Equation Editor...<\/p>\r\n\r\n<p><strong>Differential Equation Editor<\/strong><\/p>\r\n\r\n<p>Try typing <tt>dee<\/tt> in MATLAB. This will launch an example model that looks like:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/dee.png\" alt=\"Differential Equation Editor\" \/><\/p>\r\n\r\n<p>If you open one of the demo and double-click on the block, you will see a nice little user interface:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/dee_UI.png\" alt=\"Differential Equation Editor\" \/><\/p>\r\n\r\n<p>In this interface, you can type any equation you want, using the format of the <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/fcn.html\">Fcn block<\/a>.<\/p>\r\n\r\n<p>When I first saw this model and user interface, I thought <em>\"This thing looks really old, has it always been there, unnoticed?\"<\/em>. So I looked into our source code history and found out this example ships with Simulink and has been untouched since the middle of the 90's!<\/p>\r\n\r\n<p><strong>How does that work?<\/strong><\/p>\r\n\r\n<p>I strongly encourage you to look under the mask and observe how this block is implemented. It is a pretty good example of how to create models programmatically. Once you click the rebuild button in the user interface, functions like <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/delete_block.html\"><tt>delete_block<\/tt><\/a>, <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/add_block.html\"><tt>add_block<\/tt><\/a> and <a href=\"https:\/\/www.mathworks.com\/help\/simulink\/slref\/add_line.html\"><tt>add_line<\/tt><\/a> draw the differential equation in a systematic manner.<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/dee_code.png\" alt=\"Differential Equation Editor\" \/><\/p>\r\n\r\n<p>For any set of equation, the resulting model will look like this, where one Fcn block is used for each state equation and for each output equation:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/dee_example1.png\" alt=\"Differential Equation Editor\" \/><\/p>\r\n\r\n<p>To help you visualize it better, I formatted the above model to make it easier to read:<\/p>\r\n\r\n<p><img decoding=\"async\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/dee_model_clean.png\" alt=\"Differential Equation Editor\" \/><\/p>\r\n\r\n<p><strong>Now it's your turn<\/strong><\/p>\r\n\r\n<p>Give this cute little example a try and let us know what you think by leaving a <a href=\"https:\/\/blogs.mathworks.com\/seth\/?p=4231&#comment\">comment here<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/seth\/2014Q4\/dee_model_clean.png\" onError=\"this.style.display ='none';\" \/><\/div><p>This week I feel like an archaeologist who just dug out a new species of dinosaur! I discovered the Differential Equation Editor...\r\n\r\nDifferential Equation Editor\r\n\r\nTry typing dee in MATLAB. This... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/simulink\/2014\/10\/15\/special-vintage-differential-equation-editor\/\">read more >><\/a><\/p>","protected":false},"author":41,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[15,71,29],"tags":[408],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4231"}],"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\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/comments?post=4231"}],"version-history":[{"count":12,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4231\/revisions"}],"predecessor-version":[{"id":4254,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/posts\/4231\/revisions\/4254"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/media?parent=4231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/categories?post=4231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/simulink\/wp-json\/wp\/v2\/tags?post=4231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}