Why converting from Spherical to Cartesian using the command "sph2cart" gives different values than converting it manually by writing the equations of each coordinate?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1768464/image.png)
Respuesta aceptada
Voss
el 7 de Sept. de 2024
x = r .* cos(phi) .* cos(theta)
y = r .* cos(phi) .* sin(theta)
z = r .* sin(phi)
Making those corrections gives:
r = 10;
theta = pi/4;
phi = pi/3;
x = r*cos(phi)*cos(theta)
y = r*cos(phi)*sin(theta)
z = r*sin(phi)
And note that the order of the inputs to sph2cart is azimuth before elevation:
[x,y,z] = sph2cart(theta,phi,r)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Dates and Time 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!