# How can i represent a pendulum on the x-axis of a Cartesian coordinate system

I had started working with the tikz-3dplot and the pgf packages for writing a course of classical mechanic. Can you help me to draw a pendulum on the x axis of a Cartisian coordinate system? I want to do something as in the figure below: ## 1 Answer

This may suit your need \documentclass[border={10}]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{decorations.pathmorphing}
\tdplotsetmaincoords{70}{125} % view angles
\tdplotsetrotatedcoords{0}{0}{0}
\begin{document}

\begin{tikzpicture}
[tdplot_main_coords,
axis/.style={->,thick,>=stealth}
]

\coordinate (O) at (0,0,0);

\draw[axis] (O) -- (4,0,0) node[anchor=north]{$x$};
\draw[axis] (O) -- (0,4,0) node[anchor=north]{$y$};
\draw[axis] (O) -- (0,0,4) node[anchor=west]{$z$};

\draw[green,thick] (O) -- (0,1,0) -- (1,1,0) -- (1,0,0) -- cycle;
\draw[green,thick] (O) -- (0,1,0) -- (0,1,1) -- (0,0,1) -- cycle;
\draw[green,thick] (O) -- (0,0,1) -- (1,0,1) -- (1,0,0) -- cycle;

\draw[gray, line width=3pt] (.5,0,0) -- (-.5,0,0);
\draw[gray,decoration={aspect=0.4, segment length=2mm, amplitude=1.3mm,coil},decorate] (O) -- (0,0,2.5);
\draw (2,0,0) arc (0:90:2);
\end{tikzpicture}

\end{document}

• Thank you very much! It was just exactly what I needed. Also thank you for the explanation – moradov Jul 26 '17 at 9:54
• @user2367775, you're welcome. If this solves your problem, please accepts an answer by clicking on the check mark on the left. – CroCo Jul 26 '17 at 11:03