please help with this function
Mostrar comentarios más antiguos
function [th rad]=cartopolar25(x,y
t=atan(y/x); rad=sqrt(x^2+y^2); if if x<0 if y<0 th=180+t return else th=180-t return end else if y<0 th=-t return else th=t return end end
end end
Hi I need help with this code, if you guys see any mistakes please let me know. I have to make a function to determine the polar coordinates from the Cartesian plane, thanks for the help yes I was able to get the degrees now all I need is the radians any tips with this current format thanks
Respuesta aceptada
Más respuestas (3)
Jonathan Sullivan
el 23 de Jul. de 2013
help atan2
doc atan2
1 comentario
francis
el 23 de Jul. de 2013
Andrew Reibold
el 23 de Jul. de 2013
0 votos
atan doesn't take the 'y over x' value you seem to be thinking of. It takes an angle in radians....
Y = atan(X) returns the inverse tangent (arctangent) for each element of X. For real elements of X, atan(X) is in the range [–π/2, π/2].
The atan function operates element-wise on arrays. The function's domains and ranges include complex values. All angles are in radians.
Example Graph the inverse tangent function over the domain –20 ≤ x ≤ 20. x = -20:0.01:20; plot(x,atan(x)), grid on
Categorías
Más información sobre Nonlinear Operators en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!