Home > published > rTPB.m

rTPB

PURPOSE ^

This is an example of rectToPolar done badly.

SYNOPSIS ^

function[r,t]=rTPB(x,y)

DESCRIPTION ^

This is an example of rectToPolar done badly.
Note that it provides few clues about what it does or how to use it.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

function[r,t]=rTPB(x,y)
%This is an example of rectToPolar done badly.
%Note that it provides few clues about what it does or how to use it.
r=sqrt(x*x+y*y);
if (x==0) 
if (y>0)
t=3.15159/2;
elseif (y < 0)
t=3*3.15159/2;
else
t=0;
end
else
t=atan(y/x);
end
if x>0 & y>0
elseif x>0 & y<0 
t=t+2*3.15159;
elseif x<0 & y>0
t=t+3.15159;
elseif x<0 & y<0
t=t+3.15159;
end

Generated on Fri 07-Nov-2008 13:46:59 by m2html © 2005