Convert ellipse parameter from General parametric form to General polar form

I am facing problem to convert ellipse standard parameters. Everything I say here is refer to http://en.wikipedia.org/wiki/Ellipse

I know what are the General parametric form parameter . Lets call them $a$,$b$,$\varphi$, $t_X$, $t_Y$

Now I need to find the general polar form parameter. I follow the equation in wikipedia But I may misunderstand what it says.

Here is what I think

$$r_0 = \sqrt{tx^2+ty^2}$$ $$\theta_0 = \tan^{-1} \frac{t_Y}{t_X}$$ and $$\phi = \varphi$$

I think I am worng, because the output plot was not right. Please help

The following is my MATLAB code, the upper section is the general parametric form, I also draw the ellispe. The lower section is my incorrect general polar form

%==================

close all

data = [0.6397 0.9520 15.9195 1.1430 -0.3844];

a = data(1);
b = data(2);
ang = data(3);
tranX = -data(4);
tranY = -data(5);

x = zeros(1,3601);
y = zeros(1,3601);

counter = 1;

for t = 0:.1:360
x(counter) = tranX + a*cosd(t)*cosd(ang) - b*sind(t)*sind(ang);
y(counter) = tranY + a*cosd(t)*sind(ang) + b*sind(t)*cosd(ang);
counter=counter+1;
end

figure;plot(x,y)

%=============================================

r0 = norm([tranX tranY]);
theta0 = atand(tranY/tranX);
rho = ang;
rr  = zeros(1,3601);
counter = 1;

for t = 0:.1:360
P(counter) = r0*[(b*b-a*a)*cosd(t+theta0-2*rho)+(a*a+b*b)*cosd(t-theta0)];
R(counter) = (b*b-a*a)*cosd(2*t-2*rho)+a*a+b*b;
Q(counter) = sqrt(2)*a*b*sqrt(R(counter)-2*r0*r0*(sind(t-theta0))^2);
rr(counter) = (P(counter)+Q(counter))/R(counter);
counter = counter + 1;
end

[XX,YY] = pol2cart((0:.1:360)*2*pi/180,rr);

figure; plot(XX,YY,'.')
• Please, write in $\LaTeX$. You can learn some codes like, ${x}^{2n+1}$ makes ${x}^{2n+1}$, $\sin \theta$ makes $\sin \theta$ and $T_{2n}$ makes $T_{2n}$ – Pedro Tamaroff Mar 5 '12 at 21:02

Maybe $r=\sqrt{t_X^2+t_Y^2}$. Else you got a part of a circle.