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 snow off my driveway back in Massachusetts. Alright, who am I kidding, I'll be in a business meeting...
Out of curiosity to see where the planes would fly in order to transport us to Southern California, I turned to the File Exchange and discovered Simulink Dude's Flight Route Planning Simulator.
After downloading it there was a convenient run_me_now file that seemed, well, like I should run it!
It appeared easy to change the example to use my flight termini. All I had to do was change the latitude and longitude vectors.
My flight itinerary is:
- Outbound: Boston -> San Diego
- Return: San Diego -> Dallas / Fort Worth -> Boston
So I need to acquire the latitude and longitude of these cities, which could be done with an internet search. Instead, I'll do it completely within MATLAB using the Mapping Toolbox's new webmap functionality.
% Build the webmap. h = webmap;
Now I need to zoom in on Logan, recording the airport coordinates. I did this interactively, and then extracted the center using wmcenter.
Repeating these steps for San Diego and Dallas yields latitude and longitude vectors of:
% Boston, San Diego, Dallas, Boston latitude = [42.36532 32.73662 32.89819 42.36532].'; longitude = [-71.00800 -117.19137 -97.04380 -71.00800].'; % Add markers at the airports to check it wmmarker(h,latitude,longitude);
Now I comment out the latitude and longitude vectors in the run_me_now script and then run it to use the ones I defined. This will pull up the Simulink Model and the Simulink 3D Animation virtual reality world viewer where we'll be able to see the flights:
How neat is that?
Get the MATLAB code
Published with MATLAB® R2013b
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.