如何增加电路元件的尺寸

如何增加电路元件的尺寸

我想画一个简单的电路,其中一个大的平行板电容器与其间的电介质连接到电池,如下所示: 在此处输入图片描述

到目前为止我尝试了以下代码:

\documentclass[tikz,border=10pt]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) to [battery] (0,5) -- (5,5) to [capacitor] (5,0) -- (0,0); 
\end{circuitikz}
\end{document}

对于上面的代码我得到这个输出:

在此处输入图片描述

获得与第一张图片类似的输出的正确程序是什么?

答案1

你可以随时尝试用手

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{positioning,decorations.markings}
\begin{document}

\begin{tikzpicture}[
    plus/.style={decoration={markings,
            mark=between positions 0 and 1 step 0.1 
                with {\draw (1pt,0)--(5pt,0);\draw (3pt,-2pt)--(3pt,2pt);}}},
    minus/.style={decoration={markings,
            mark=between positions 0 and 1 step 0.1 
                with {\draw (1pt,0)--(5pt,0);}}}]

\draw (-.5,.05) -- coordinate (aux) (.5,.05);
\draw (-.3,-.05) -- coordinate (aux1) (.3,-.05);
\node at (-.7,0) {$V$};
\node[draw,minimum width=2cm, minimum height=15mm] at (4,0) (c) {};
\draw ([yshift=1mm]c.north west)--coordinate (aux2) ([yshift=1mm]c.north east);
\path[postaction={decorate,plus}] ([yshift=2mm]c.north west)-- ([yshift=2mm]c.north east);
\path[postaction={decorate,minus}] ([yshift=-1mm]c.north west)-- ([yshift=-1mm]c.north east);
\draw ([yshift=-1mm]c.south west)--coordinate(aux3) ([yshift=-1mm]c.south east);
\path[postaction={decorate,plus}] ([yshift=1mm]c.south west)-- ([yshift=1mm]c.south east);
\path[postaction={decorate,minus}] ([yshift=-2mm]c.south west)-- ([yshift=-2mm]c.south east);
\draw (aux)--++(90:2cm) -| (aux2);
\draw (aux1)--++(-90:2cm) -| (aux3);
\draw[<->] ([shift={(-1mm,1mm)}]c.north west) -- node [left] {$d$}([shift={(-1mm,-1mm)}]c.south west);

\draw[->] ([shift={(3mm,1mm)}]c.north east) -- ++(-90:18mm) node [below] {$E=V/d$};

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

第二个选项可circuitikz通过“/tikz/circuitikz/bipoles/length=xcm”获得,其中本演示中的 x=4 cm 是可变的。(但需要相应地更改坐标)。为了进行比较,显示了默认尺寸中间的第二个电容器。

在此处输入图片描述

代码

\documentclass[tikz,border=10pt]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{decorations.markings}
\tikzset{
plus/.style={decoration={markings,
mark=between positions 0 and 1 step 0.05 with 
{\draw (1pt,0)--(5pt,0);\draw (3pt,-2pt)--(3pt,2pt);}}
,preaction={decorate}
},
minus/.style={decoration={markings,
mark=between positions 0 and 1 step 0.05 
with {\draw (1pt,0)--(5pt,0);}}
,preaction={decorate}
},
}
\begin{document}

\begin{circuitikz}
\draw (0,0) to [battery1,l=V] (0,5) -- (5,5) to    
[capacitor,/tikz/circuitikz/bipoles/length=4cm] (5,0) -- (0,0); 
\draw (2,5) to[capacitor](2,0);                             % for comparison
\path[plus] (4,3)--(6,3) (4,2.2)--(6,2.2);                  % charges
\path[minus] (4,2.8)--(6,2.8) (4,2.0)--(6,2.0);             % charges
\draw (4,2.86) rectangle (6,2.15);
\draw[<->] (3.7,2.9) -- node [left] {$d$}(3.7,2.1);         % label
\draw[->] (6.3,3) -- node [below,pos=1] {$E=V/d$} (6.3,2.0);% label
\end{circuitikz}
\end{document}

相关内容