| Electronics > Beginners |
| How can i put "gravity" to (Lat, Long to X, Y, Z) ? |
| (1/1) |
| ammjy:
Hello, EEVBlog users ! Always thank you for your kind help and time. I want make acceleration data through convert (Lat, Long to X, Y, Z). but, i can't figure out how i can put "gravity" to X, Y, Z equations to make acceleration data. if latitude and longitude is, Lat = [-30:2:30]; Long = [-90:1:90]; i can make latitude and longitude as follows, lat = lat * pi/180; long = long * pi/180; phi = pi/2 - lat; theta = long; than, XYZ is x = sin(phi) * cos(theta); y = sin(phi) * sin(theta); z = cos(phi); Can I add g like this? g = [ 0 0 9.8 ]; Acc_x = -g * sin(phi) * cos(theta); Acc_y = g * sin(phi) * sin(theta); Acc_z = -g * cos(phi); I am so sorry, my question is so vague. If you don't mind, could you give to me advise ? Thanks you for reading, ! Please, let me know ! |
| agehall:
If you just want a vector that represents the direction of g at every point of the sphere, that would essentially be the negative normal at each point. So just use g=-9.81 (note: not a vector!) and then calculate the vector at each point by doing g * [x y z] where x, y and z are calculated as you suggested and you should end up with a vector that describes g as a directional vector at each point [x y z]. |
| ammjy:
Thanks you so much, also Thanks you for your time, Ms. Agehall. I understood your kind answer. Have a good day ! Acc_x = -g * sin(phi) * cos(theta); Acc_y = -g * sin(phi) * sin(theta); Acc_z = -g * cos(phi); |
| soldar:
--- Quote from: agehall on April 18, 2019, 08:20:13 am ---If you just want a vector that represents the direction of g at every point of the sphere, that would essentially be the negative normal at each point. So just use g=-9.81 (note: not a vector!) and then calculate the vector at each point by doing g * [x y z] where x, y and z are calculated as you suggested and you should end up with a vector that describes g as a directional vector at each point [x y z]. --- End quote --- That is a simplification that might be sufficient or not depending on what the objective is. It assumes the world is a sphere and with uniform acceleration of gravity. For more precise calculations search for "convert wgs84 to polar" https://www.pgc.umn.edu/apps/convert/ |
| ammjy:
Thanks you for your time, and your kind attention ! i understood very well your point :) i totally agree. |
| Navigation |
| Message Index |