{"id":5058,"date":"2014-01-24T09:00:01","date_gmt":"2014-01-24T14:00:01","guid":{"rendered":"https:\/\/blogs.mathworks.com\/pick\/?p=5058"},"modified":"2017-07-05T15:17:27","modified_gmt":"2017-07-05T19:17:27","slug":"flight-route-planning-simulator","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/pick\/2014\/01\/24\/flight-route-planning-simulator\/","title":{"rendered":"Flight Route Planning Simulator"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/answers\/contributors\/3208495\">Sean<\/a>'s pick this week is <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/31142-international-flight-route-planning-simulator-using-aerospace-blockset\">International Flight Route Planning Simulator<\/a> by <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/30904\">Simulink Dude<\/a>.\r\n      <\/p>\r\n   <\/introduction>\r\n   <h3>San Diego<a name=\"1\"><\/a><\/h3>\r\n   <p>At the time of this posting, I will be in San Diego, California.  I fully expect to be sitting on a beach or a sailboat getting a nice sunburn instead of shoveling\r\n      snow off my driveway back in Massachusetts.  Alright, who am I kidding, I'll be in a business meeting...\r\n   <\/p>\r\n   <p>Out of curiosity to see where the planes would fly in order to transport us to Southern California, I turned to the File Exchange\r\n      and discovered Simulink Dude's <i>Flight Route Planning Simulator<\/i>.\r\n   <\/p>\r\n   <p>After downloading it there was a convenient <tt>run_me_now<\/tt> file that seemed, well, like I should run it!\r\n   <\/p>\r\n   <h3>My Own Flight Path<a name=\"2\"><\/a><\/h3>\r\n   <p>It appeared easy to change the example to use my flight termini.  All I had to do was change the latitude and longitude vectors.<\/p>\r\n   <p>My flight itinerary is:<\/p>\r\n   <div>\r\n      <ul>\r\n         <li>Outbound: <b>Boston<\/b> -&gt; <b>San Diego<\/b><\/li>\r\n         <li>Return: <b>San Diego<\/b> -&gt; <b>Dallas \/ Fort Worth<\/b> -&gt; <b>Boston<\/b><\/li>\r\n      <\/ul>\r\n   <\/div>\r\n   <p>So I need to acquire the latitude and longitude of these cities, which could be done with an internet search.  Instead,\r\n      I'll do it completely within MATLAB using the <a href=\"https:\/\/www.mathworks.com\/products\/mapping\/\">Mapping Toolbox<\/a>'s new <a href=\"\">webmap<\/a> functionality.\r\n   <\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\"><span style=\"color: #228B22\">% Build the webmap.<\/span>\r\nh = webmap;<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainifp\/mainifp_01.png\"> <p>Now I need to zoom in on Logan, recording the airport coordinates.  I did this interactively, and then extracted the center\r\n      using <tt>wmcenter<\/tt>.\r\n   <\/p>\r\n   <p>Repeating these steps for San Diego and Dallas yields latitude and longitude vectors of:<\/p><pre style=\"background: #F9F7F3; padding: 10px; border: 1px solid rgb(200,200,200)\"><span style=\"color: #228B22\">% Boston, San Diego, Dallas, Boston<\/span>\r\nlatitude = [42.36532 32.73662 32.89819 42.36532].';\r\nlongitude = [-71.00800 -117.19137 -97.04380 -71.00800].';\r\n\r\n<span style=\"color: #228B22\">% Add markers at the airports to check it<\/span>\r\nwmmarker(h,latitude,longitude);<\/pre><img decoding=\"async\" vspace=\"5\" hspace=\"5\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainifp\/mainifp_02.png\">  <p>Now I comment out the <i>latitude<\/i> and <i>longitude<\/i> vectors in the <tt>run_me_now<\/tt> script and then run it to use the ones I defined.  This will pull up the <a href=\"https:\/\/www.mathworks.com\/products\/simulink\/\">Simulink<\/a> Model and the <a href=\"https:\/\/www.mathworks.com\/products\/3d-animation\/\">Simulink 3D Animation<\/a> virtual reality world viewer where we'll be able to see the flights:\r\n   <\/p>\r\n<p>\r\n<embed src=\"https:\/\/blogs.mathworks.com\/pick\/files\/flight.mp4\" height=\"400\" width=\"600\">\r\n<\/p>\r\n\r\n   <p>How neat is that?<\/p>\r\n   <p>Plus, this also means I can now <b>officially<\/b> say: I've used the <a href=\"https:\/\/www.mathworks.com\/products\/aerotb\/\">Aerospace Toolbox<\/a> and <a href=\"https:\/\/www.mathworks.com\/products\/aeroblks\/\">Blockset<\/a> :)\r\n   <\/p>\r\n   <h3>Comments<a name=\"6\"><\/a><\/h3>\r\n   <p>Give it a try and let us know what you think <a href=\"https:\/\/blogs.mathworks.com\/pick\/?p=5058#respond\">here<\/a> or leave a <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/31142-international-flight-route-planning-simulator-using-aerospace-blockset#comments\">comment<\/a> for Simulink Dude.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_a6a7bd2f6bfe4c92bcc37e5d9eb2ee7e() {\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='a6a7bd2f6bfe4c92bcc37e5d9eb2ee7e ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' a6a7bd2f6bfe4c92bcc37e5d9eb2ee7e';\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        author = 'Sean de Wolski';\r\n        copyright = 'Copyright 2014 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 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');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }   \r\n      \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_a6a7bd2f6bfe4c92bcc37e5d9eb2ee7e()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; R2013b<br><\/p>\r\n<\/div>\r\n<!--\r\na6a7bd2f6bfe4c92bcc37e5d9eb2ee7e ##### SOURCE BEGIN #####\r\n%% International Flight Route Planning Simulator\r\n%\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/answers\/contributors\/3208495 Sean>'s pick this week is\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/31142-international-flight-route-planning-simulator-using-aerospace-blockset International Flight Route Planning Simulator> by\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/30904 Simulink Dude>.\r\n% \r\n\r\n%% San Diego\r\n%\r\n% At the time of this posting, I'll bein San Diego,\r\n% California.  I fully expect to be sitting on a beach or a sailboat\r\n% getting a nice sunburn instead of shoveling snow off my driveway back in\r\n% Massachusetts.  Alright, who am I kidding, I'll be in a business meeting...\r\n%\r\n% Out of curiosity to see where the planes would fly in order to transport\r\n% us to Southern California, I turned to the File Exchange and discovered\r\n% Simulink Dude's _Flight Route Planning Simulator_.\r\n%\r\n% After downloading it there was a convenient |run_me_now| file that\r\n% seemed, well, like I should run it!\r\n%\r\n\r\n%% My Own Flight Path\r\n%\r\n% It appeared easy to change the example to use my flight termini.  All I\r\n% had to do was change the latitude and longitude vectors.\r\n%\r\n% My flight itinerary is: \r\n%\r\n% * Outbound: *Boston* -> *San Diego*\r\n% * Return: *San Diego* -> *Dallas Fort Worth* -> *Boston*\r\n%\r\n% So I needed to acquire the latitude and longitude of these cities, which\r\n% could be done with an internet search.  Instead, I'll do it completely\r\n% within MATLAB using the <https:\/\/www.mathworks.com\/products\/mapping\/\r\n% Mapping Toolbox>'s new\r\n% <\r\n% webmap> functionality.\r\n\r\n% Build the webmap.\r\nh = webmap;\r\n\r\n%%\r\n%\r\n% Now I need to zoom in on Logan, recording the airport coordinates.  I did\r\n% this interactively, and then extracted the center using |wmcenter|.\r\n%\r\n% Repeating these steps for San Diego and Dallas yields latitude and\r\n% longitude vectors of:\r\n\r\n% Boston, San Diego, Dallas, Boston\r\nlatitude = [42.36532 32.73662 32.89819 42.36532].'; \r\nlongitude = [-71.00800 -117.19137 -97.04380 -71.00800].';\r\n\r\n% Add a markers at the airports to check it\r\nwmmarker(h,latitude,longitude);\r\n\r\n%%\r\n% Now I comment out the _latitude_ and _longitude_ vectors in the\r\n% |run_me_now| script and then run it to use ours:\r\n%\r\n%\r\n%\r\n\r\n%% \r\n% How neat is that?\r\n%\r\n% Plus, this also means I can now *officially* say: I've used the\r\n% <https:\/\/www.mathworks.com\/products\/aerotb\/ Aerospace Toolbox> :)\r\n%\r\n\r\n%% Comments\r\n% \r\n% Give it a try and let us know what you think\r\n% <https:\/\/blogs.mathworks.com\/pick\/?p=5058#respond here> or leave a\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/31142-international-flight-route-planning-simulator-using-aerospace-blockset#comments\r\n% comment> for Simulink Dude.\r\n%\r\n \r\n\r\n##### SOURCE END ##### a6a7bd2f6bfe4c92bcc37e5d9eb2ee7e\r\n-->","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img decoding=\"async\"  class=\"img-responsive\" src=\"https:\/\/blogs.mathworks.com\/images\/pick\/Sean\/mainifp\/mainifp_01.png\" onError=\"this.style.display ='none';\" \/><\/div><p>\r\n   \r\n      Sean's pick this week is International Flight Route Planning Simulator by Simulink Dude.\r\n      \r\n   \r\n   San Diego\r\n   At the time of this posting, I will be in San Diego,... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/pick\/2014\/01\/24\/flight-route-planning-simulator\/\">read more >><\/a><\/p>","protected":false},"author":87,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5,16,24],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5058"}],"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=5058"}],"version-history":[{"count":28,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5058\/revisions"}],"predecessor-version":[{"id":8681,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/posts\/5058\/revisions\/8681"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/media?parent=5058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/categories?post=5058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/pick\/wp-json\/wp\/v2\/tags?post=5058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}