Question
You will work with the data file cities.txt. The file is available here: https://1drv.ms/t/s!AkEp1U-yQu2xjVepGZe9KVbyS7z8 You will have to calculate the distance between two points on
You will work with the data file cities.txt. The file is available here: https://1drv.ms/t/s!AkEp1U-yQu2xjVepGZe9KVbyS7z8
You will have to calculate the distance between two points on the planet by assuming Earth is a perfect sphere with radius R = 6360 km. You must use the Haversine formula to calculate this distance:
where are the latitude (north-south position) of point 1 and latitude of point 2, and are the longitude (east-west position) of point 1 and longitude of point 2. All of these magnitudes are in radians.
Please remember latitudes and longitudes in the data file are based on geographical degrees, not decimal degrees. This means you will have to convert the data from its current DMS (degree-minute-second) format. This can be easily achieved by considering a degree is divided into sixty minutes. That means we can convert from a DMS coordinate to a decimal degree coordinate Cdec by using the following formula:
For example, the DMS coordinate 2326' N converts to 23.43 N using this system. Finally, notice this approach gives you degrees, not radians.
Write a program in Matlab that suggests a road trip itinerary. You will use the cities.txt file. Your program should read the data file and output the suggested road trip itinerary (list of cities) organized by latitude or longitude as required by the list of features below. You can assume all travel happens in straight lines. Your program should do the following:
1. Read the data in cities.txt.
2. Ask the user for a specific state in the US they want to visit.
3. Sort the cities in that state north-south or east-west depending on which direction the state is longer. For example, California cities would be north-south while Tennessee cities would be east-west.
4. Output a road trip itinerary with all the cities in order. Add a rest stop whenever the distance between the cities is greater or equal to 100 miles.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started