How to Write Latitude and Longitude in MATLAB?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Our programming assignment asked us to find the distance between two cities. We were given the cities, their latitudes and longitudes and an equation to plug in. We were also given the answers, so all we had to do was write a code that spit out answers that matched the ones given. I wrote a code that works, but gives me the incorrect answers. I am wondering if I input the latitude and longitude incorrectly. Here's an example of what was given and how I wrote it in code:
Prague's Latitude = N 50 degrees, 15 arc-minutes (1 degree = 60 arc-minutes) Prague's Longitude = E 14 degrees, 26 arc-minutes
I wrote this in code as:
pragueLatitude = 50 + (15*(1/60)); pragueLongitude = 14 + (26(1/60));
While this gave me an answer, it was not the correct answer. Is there anything I am doing wrong on the coding end? Perhaps with the direction (the N/E in the give latitude and longitude). Any help would be greatly appreciated! Thanks.
0 comentarios
Respuestas (1)
Steven
el 20 de Oct. de 2015
Work it out on paper, when you find equations that work you can easily transfer it to the computer and let it do the work. It is important to be able to figure things out on paper, so that if the computer is giving the wrong answer (and they often do) you can check it.
0 comentarios
Ver también
Categorías
Más información sobre Simulink Functions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!