This is an example of rectToPolar done badly. Note that it provides few clues about what it does or how to use it.
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