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);endend
MATLAB: There are many errors I cannot spot in this script. Can someone help please
basic functionMATLAB
Best Answer