There are many errors I cannot spot in this script. Can someone help please
古いコメントを表示
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 件のコメント
BobH
2020 年 3 月 11 日
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?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Polar Plots についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!