Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

rect2polar, rectangular to polar, complex number

988 views
Skip to first unread message

jm-ZOGG

unread,
Mar 24, 2006, 4:07:46 AM3/24/06
to
Hello

Has the function rect2polar(Z) been removed in Version 4.0?
This function was used to convert complex number from rectangular form
to polar form.
Im my new version Scilab 4.0 it doesnt work.


Many thanks for your answer

JM

ror7

unread,
Mar 24, 2006, 6:50:15 AM3/24/06
to
let's see if this helps you:

function [r,th]=rect2pol(x,y)
//rectangle to polar coordinate conversion
//based on "Scilab from a Matlab User's Point of View", Eike Rietsch,
2002
r=sqrt(x^2+y^2);
th = atan(y,x)*180/%pi;
endfunction

function [r,th]=cr2pol(a)
//complex number rectangle to polar conversion above
[r,th]=rect2pol(real(a),imag(a));
endfunction

-->[mag,ang]=rect2pol(1,1)
ang =

45.
mag =

1.4142136

-->c=0+1*%i
c =

i

-->[mag2,ang2]=cr2pol(c)
ang2 =

90.
mag2 =

1.

0 new messages