4

I'm trying to draw the magnetic lines of force in a coil that should looks like this picture using the tikz package. I've tried to use a foreach loop with controls but (maybe I'm placing the controls wrongly) I don't get ellipse like lines of force... The code I used is this one:

\begin{tikzpicture}
    \tikzstyle arrowstyle=[scale=2] %Arrow size
    \draw[thick, black, postaction={decorate,decoration={markings,mark=at position .42 with {\arrow[arrowstyle]{stealth}}}}] (0,0) ellipse (1 and 2);
    \foreach \x in {0,0.5,...,5}
        \draw (-3,\x) .. controls (0,0) and (0,0) .. (3,\x);
\end{tikzpicture} 

I think lines must be a part of an ellipse but I don't know how to place the inner point of these ellipses.

Personnal try of drawing magnetic lines of force into a spire

4

There are better ways, polar plots e.g., but you can start with something like this:

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{arrows.meta,decorations.markings}

\begin{document}

\begin{tikzpicture}
    \tikzstyle arrowstyle=[scale=2] %Arrow size
    \draw[thick, black, postaction={decorate,decoration={markings,mark=at position .42 with {\arrow[arrowstyle]{stealth}}}}] (0,0) ellipse (1 and 2);
    \path[clip] (-2,-2.7) rectangle (2,2.7);
    \foreach \y in {15,30,...,75} {
        \draw (0,{2*tan(\y)+1.5*cos(\y)}) ellipse ({1.5*tan(\y)} and {2*tan(\y)});
        \draw (0,{-2*tan(\y)-1.5*cos(\y)}) ellipse ({1.5*tan(\y)} and {2*tan(\y)});
    }
    \draw (-3,0) -- (3,0);
\end{tikzpicture} 

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.