There are many errors I cannot spot in this script. Can someone help please
Mostrar comentarios más antiguos
This is what I am working with and I absolutely cannot get it to work.
function [r,theta,phi] = EGA118_M2_Q3s (x,y,z)
%%
%% This function returns the spherical polar coordinates (r, theta, phi)
%% that correspond to the input Cartesian coordinates (x, y, z).
%% theta (azimuthal angle) and phi (polar angle) are expressed in degrees.
if nargin == 0
r = 0;
theta = atan2(y,x);
phi = 0;
elseif nargin == 1
r = x;
theta = atan2(y,x);
phi = 0;
elseif nargin == 2
r = sqrt(x^2+y^2);
theta = atan2(y,x);
phi = 0;
else
r = sqrt(x^2+y^2);
theta = atan2d(y,x);
phi = atan2(z,r);
end
end
1 comentario
BobH
el 11 de Mzo. de 2020
When nargin is 0, x and y are not provided, so what values are being used in the atan2?
Similarly for nargin of 1, what value is being used for y in the atan2?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Polar Plots en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!