2

I am trying to plot a rotation about the x-axis of this cycloid function to show the volume of the surface of revolution.

This is what the curve looks like. Ignore the purple cirlce.

cycloid

The is the code I am using, I don't know how to get the sphere to show up.

\begin{tikzpicture}
        \begin{axis}[
            title=Revolution of one arch of cycloid,
            colormap/cool,
                    ]
            \addplot3[
                mesh,
                samples=50,
                domain=-8:8,
                    ]
            {-cos^3(t)+3cos^2(t)-3cos(t)+1};
\addlegendentry{$\pi \int_{0}^{2\pi} -cos^3(t)+3cos^2(t)-3cos(t)+1 dt$}
\end{axis}
\end{tikzpicture}

I know the formula should be $\int_{a}^{b} (y^2(t))*(x'(t))$ but I just get confused by the LaTeX syntax.

3
  • 1
    You could use something like \addplot3 ({calculate x},{calculate y},{calculate z}) with three formulas representing how to get x,y,z.
    – TeXnician
    May 3, 2017 at 5:15
  • @texenthusiast that question is somewhat related, but I need help with syntax on how to Rotate about x-axis. Output should be a sphere made out of mesh. May 3, 2017 at 5:34

1 Answer 1

1

Use the same technique that one transforms polar coordinate to cartesian coordinate.

\documentclass[border=9,tikz]{standalone}
\usetikzlibrary{3d}
\usepackage{pgfplots}
\pgfplotsset{compat=1.14}

\begin{document}

\begin{tikzpicture}[cap=round,join=round]
    \begin{axis}[axis equal,colormap/cool]
        \addplot3[surf,samples=40,domain=0:360,y domain=0:360,z buffer=sort]
            ({\x/57.29578-sin(\x)},{(1-cos(\x))*cos(\y)},{(1-cos(\x))*sin(\y)});
    \end{axis}
\end{tikzpicture}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .