If the Xnew is negative the answer for X should also be negative, but this is not the case. The Y does work correctly however. I included the input array, the r is constantly 13.
function [X,Y,Z] = bolcoordinaten2(Xnew,Ynew,r)Z = r-cos(2*atan((abs(sqrt((Xnew.^2)+(Ynew.^2))))./(2*r))).*r;a = cos(atan(Ynew./Xnew)).*r.*sin(2*atan((abs(sqrt((Xnew.^2)+(Ynew.^2))))./(2*r))); if Xnew < 0 X = a*(-1); else X = a; endb = sin(atan(Ynew./Xnew)).*r.*sin(2*atan((abs(sqrt((Xnew.^2)+(Ynew.^2))))./(2*r))); if Ynew < 0 Y = b*(-1); else Y= b; endend
Best Answer