« home

Plate Capacitor

Creator: Creator: Izaak Neutelings (original)

physicselectrodynamicselectronicscetztikz

Parallel plate capacitor with dipolar polarization.


Plate Capacitor

  Download

PNGPDFSVG

  Code

  LaTeX

plate-capacitor.tex (71 lines)

\documentclass[border=3pt,tikz]{standalone}

\usepackage{mathtools}
\usetikzlibrary{decorations.markings}

\colorlet{Ecolor}{orange!90!black}
\colorlet{pluscolor}{red!60!black}
\colorlet{minuscolor}{blue!60!black}
\tikzstyle{anode}=[top color=red!20, bottom color=red!50]
\tikzstyle{cathode}=[top color=blue!20, bottom color=blue!40]
\tikzstyle{charge+}=[very thin,top color=red!50, bottom color=red!80]
\tikzstyle{charge-}=[very thin,top color=blue!40, bottom color=blue!70]
\tikzset{EFieldLine/.style={
  Ecolor, decoration={markings, mark=at position #1 with {\arrow{stealth}}}, postaction={decorate}}
}

\def\dph{0.3} % dipole height
\def\dpw{0.1} % dipole width
\def\dipole#1{
  \begin{scope}[shift={(#1)}]
    \draw[charge-] (-\dph,0) to[out=90,in=180] (0,\dpw) -- (0,-\dpw) to[out=180,in=-90] cycle;
    \draw[charge+] ( \dph,0) to[out=90,in=0] (0,\dpw) -- (0,-\dpw) to[out=  0,in=-90] cycle;
    \node[scale=0.7] at (-\dph/2,0) {$-$};
    \node[scale=0.7] at ( \dph/2,0) {$+$};
  \end{scope}
}

\def\height{5}
\def\width{3}
\def\platewidth{0.5}
\def\dielwidth{0.13*\width}
\def\nfieldlines{6}
\def\ncharges{7}

\begin{document}
% capacitor with dipolar polarization
\begin{tikzpicture}

  % dielectric slab
  \draw[orange!60!black,fill=orange!80!brown!5]
  (\dielwidth,-0.03*\height) rectangle (\width-\dielwidth,1.03*\height)
  node[Ecolor, above=3cm, midway] {$\vec E$}
  node[above, pluscolor] {$+Q_\text{surf}$}
  node[above, minuscolor] at (1.3*\dielwidth,1.03*\height) {$-Q_\text{surf}$};

  % electric field
  \foreach \i [evaluate={\y=(\i-0.75)*\height/(\nfieldlines-0.5);}] in {1,...,\nfieldlines}{
      \draw[EFieldLine={0.54},very thick] (0,\y) --++ (\width,0);
    }

  % plates
  \draw[anode] (0,0) rectangle++ (-\platewidth,\height)
  node[above, pluscolor] {$+Q_\text{C}$};
  \draw[cathode] (\width,0) rectangle++ (\platewidth,\height)
  node[above, minuscolor] {$-Q_\text{C}$};

  \foreach \i [evaluate={\y=(\i-0.5)*\height/\ncharges;}] in {1,...,\ncharges}{
      \node[pluscolor] at (-\platewidth/2,\y) {$+$};
      \node[minuscolor] at (\width+\platewidth/2,\y) {$-$};
    }

  % dipoles
  \foreach \i in {0.25, 0.5, 0.75}{
      \foreach \j in {1, 3, 5, 7, 9}{
          \dipole{\i*\width,0.\j*\height}
        }
    }

\end{tikzpicture}
\end{document}

  Typst

plate-capacitor.typ (98 lines)

#import "@preview/cetz:0.3.2": canvas, draw
#import draw: line, rect, content, bezier, group, anchor

#set page(width: auto, height: auto, margin: 8pt)

// Constants
#let height = 5
#let width = 4
#let plate-width = 0.5
#let diel-width = 0.16 * width
#let n-field-lines = 7
#let n-charges = 7

// Colors
#let e-color = rgb("#e67300")
#let plus-color = rgb("#cc2200").transparentize(20%)
#let minus-color = rgb("#0044cc").transparentize(20%)

// Helper function to draw a capacitor plate with charges
#let plate(x, is-anode: true) = {
  let color = if is-anode { plus-color } else { minus-color }
  let fill-base = if is-anode { rgb("#f29797") } else { rgb("#9fc2f6") }
  let sign = if is-anode { $+$ } else { $-$ }

  // Draw plate with gradient fill
  rect(
    (x, 0),
    (x + plate-width, height),
    stroke: (paint: color, thickness: .7pt),
    fill: gradient.linear(fill-base.lighten(50%), fill-base, angle: 90deg),
  )
  // Draw charge label
  content(
    (x + plate-width / 2, height + 0.1),
    text(fill: color)[$sign Q_"C"$],
    anchor: "south",
  )
  // Draw charges
  for ii in range(n-charges) {
    let y = ii * height / n-charges + 0.325
    content((x + plate-width / 2, y), text(fill: color)[$sign$])
  }
}

// Helper function to draw a dipole
#let dipole(x, y, ..style) = group({
  let plus-grad = gradient.linear(
    angle: 90deg,
    minus-color.lighten(30%),
    minus-color.darken(30%),
  )
  let minus-grad = gradient.linear(
    angle: 90deg,
    plus-color.lighten(30%),
    plus-color.darken(30%),
  )
  rect(x, ((x, "|-", y), 50%, y), fill: plus-grad, radius: (west: .5), name: "minus", ..style)
  rect(y, ((x, "-|", y), 50%, x), fill: minus-grad, radius: (east: .5), name: "plus", ..style)
  content("plus", [+])
  content("minus", [--])
})

#canvas({
  // Dielectric slab
  rect(
    (diel-width, -0.03 * height),
    (width - diel-width, 1.08 * height),
    stroke: e-color,
    fill: rgb("#fff8f0"), // very light orange
  )
  content((width / 2, 1.15 * height), text(fill: e-color)[$arrow(E)$])
  content((width * 0.8, 1.09 * height), text(fill: minus-color)[$+Q_"surf"$], anchor: "south")
  content((1.3 * diel-width, 1.09 * height), text(fill: plus-color)[$-Q_"surf"$], anchor: "south")

  // Electric field lines
  for ii in range(n-field-lines) {
    let y = (ii + 0.42) * height / n-field-lines
    line(
      (-plate-width, y),
      (width + plate-width, y),
      stroke: (paint: e-color, thickness: 1.2pt),
      mark: (pos: 0.5, end: "stealth", fill: e-color),
    )
  }

  // Draw plates
  plate(width, is-anode: false) // Left plate (cathode)
  plate(-plate-width, is-anode: true) // Right plate (anode)

  // Dipoles
  for x in (0.3, 0.5, 0.7) {
    for ii in range(n-field-lines) {
      let y = (ii + 0.94) * height / n-field-lines
      dipole((x * width - 0.3, y - 0.12), (x * width + 0.3, y + 0.12), stroke: 0.5pt)
    }
  }
})