www.pudn.com > PMSM111.zip > ppole.m, change:2011-06-05,size:252b


function y=ppole(x); 
 
AA=sqrt(x(1)^2+x(2)^2); 
if abs(AA)<0.01     
    PP=0;     
else 
    PP=atan(x(2)/x(1)); 
    if PP<0 
      if x(1)<0  
          PP=PP+pi; 
      end; 
    elseif x(1)<0 
        PP=PP-pi; 
    end; 
end; 
y(1)=AA; 
y(2)=PP;