Parametrisation of the surface a torus For a calculus question  I need to parameterise the surface of the torus generated by rotating the circle given by $(x-b)^2+z^2=a^2$ around the $z$-axis (with $0<a<b$).
I've had a go at this, and have come up with $$\vec{r}(\theta,\phi)=((a\cos\theta+b)\cos\phi, (a\cos\theta+b)\sin\phi, a\sin\theta), ~~ \theta,\phi\in [0,2\pi].$$
I haven't done anything like this for a while now, so I've kind of forgotten how it all goes. So I've tried plotting this on WolframAlpha to see if it's correct, but I can't get it to actually plot a surface defined in this way. I have a copy of Matlab, is there any way I could plot this surface on there to see if it's correct? Basically how can I check if I'm right or not? Failing that, could somebody please just point out if I'm wrong?
 A: Your formula is absolutely correct, just look here for verification.
A: A circle of radius $a$ centered at $(b,0)$ in the plane $xz$ has the parametric equation
$$x=a\cos(\theta)+b,z=a\sin(\theta),$$ with $\theta$ in the range $[0,2\pi]$ for a full circle.
Now you rotate the plane $xz$ around $z$ by $x\leftarrow x\cos(\phi),y\leftarrow x\sin(\phi)$,  with $\phi$ in the range $[0,2\pi]$ for a full turn,
$$x=(a\cos(\theta)+b)\cos(\phi),\\
y=(a\cos(\theta)+b)\sin(\phi),\\
z=a\sin(\theta).$$
If you freeze $\theta$, you get a circle in a plane parallel to $xy$, of the form:
$$x=r\cos(\phi),y=r\sin(\phi).$$
A: You can plot this surface in WolframAlpha.  The correct syntax to use is:
ParametricPlot3D[{(2 Cos[u]+3) Cos[v], (2 Cos[u]+3) Sin[v], 2 Sin[u]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}]

where I have chosen $a = 2$, $b = 3$.  The output looks like this.
A: Here is the MATLAB code:
[phi,theta] = meshgrid(linspace(0,2*pi),linspace(0,2*pi));

r = 1; b = 3;

x = (r.*cos(theta)+b).*cos(phi);
y = (r.*cos(theta)+b).*sin(phi);
z = (r.*sin(theta));
s = surf(x,y,z);

alpha(s,0.5)

shading flat

axis equal

Run this in script (or quickly in Command Window).
