![]() |
从笛卡尔坐标转换为对数极坐标
我想将笛卡尔系统中给出的一些点坐标转换为对数极坐标笛卡尔系统。
但是,我不确定如何很好地执行atan操作。 目前,我正在按照以下步骤进行操作,这看起来非常丑陋。 Xlp = zeros(n, 2); Xlp(:, 1) = log(sqrt(Xt(:, 1).^2 + Xt(:, 2).^2)); sel = Xlp(:, 1) >= 0 && Xlp(:, 2) >= 0; Xlp(sel, 2) = atan(Xt(sel, 2) / Xt(sel, 1)); sel = Xlp(:, 1) >= 0 && Xlp(:, 2) < 0; Xlp(sel, 2) = repmat(2*pi, size(sel), 1) + atan(Xt(sel, 2) / Xt(sel, 1)); sel = Xlp(:, 1) < 0 && Xlp(:, 2) >= 0; Xlp(sel, 2) = repmat(pi, size(sel), 1) + atan(Xt(sel, 2) / Xt(sel, 1)); sel = Xlp(:, 1) < 0 && Xlp(:, 2) < 0; Xlp(sel, 2) = repmat(pi, size(sel), 1) + atan(Xt(sel, 2) / Xt(sel, 1)); 输入点在Xt中,第一列为X坐标值,第二列为Y坐标值。 Xlp包含对数极坐标,作为对应于距离的第一列和对应于角度的第二列给出。 [B]回答:[/B] 使用[URL="http://www.mathworks.com/help/techdoc/ref/atan2.html"]atan2()[/URL]为您完成所有这些艰苦的工作。 [url=https://stackoverflow.com/questions/4172367]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 23:18。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.