Solve this particular system of equations
Show older comments
Okay so I have 2 equations, for the latitude and longitude, of a sphere when looking at it from a distance. The latitude and longitude can both be found by giving the equation a value for theta (the rotation angle from the vertical) and phi (the azimuthal angle) - just regular spherical polar coordinates.
i.e. theta = 70, phi = 90 ==> b (latitude) = 34, l (longitude) = 0. For example.
My question is now: For any given value of l and b, I would like to find the path length through the sphere. So any given (l,b) pair will give me two solutions of both theta and phi, which when the radius of the sphere is known (which I do), will give me a way of measuring the distance from one intersection point of the surface to the other.
How exactly do I go about doing this? I tried using Matlab's symbolic toolbox solve function, but it seems to me that by doing that, it will be extremely tedious, as I will want this to be as detailed as possible, so I will need to know (theta,phi) pairs for many (l,b) pairs. So ideally I'd think I would want to write a function yeah? but by using the symbolic toolbox solve, the equation entered has to be a string (i.e. S = solve('34 = f(theta,phi), '10 = g(theta,phi), theta, phi) where here, I'm trying to solve for l = 10, b = 34). Ideally, I would want to be able to enter a vector of b values and l values, and get a vector solution out for both theta and phi - basically do it in one hit if I can.
Please let me know if this is possible, and if you need any further clarification or any of my formulae then just let me know!
Thanks,
Joshua
Accepted Answer
More Answers (1)
Chad Greene
on 10 Jan 2015
For path length through a sphere, transform your spherical coordinates to 3D cartesian coordinates x,y,z with sph2cart. Then the distance from a to b is
sqrt((xb-xa)^2 + (yb-ya)^2 + (zb-za)^2)
Categories
Find more on Axes Transformations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!