![我怎样才能向该 RLC 电路添加开关?](https://linux22.com/image/440234/%E6%88%91%E6%80%8E%E6%A0%B7%E6%89%8D%E8%83%BD%E5%90%91%E8%AF%A5%20RLC%20%E7%94%B5%E8%B7%AF%E6%B7%BB%E5%8A%A0%E5%BC%80%E5%85%B3%EF%BC%9F.png)
我得到了这个 RLC 电路:
一切已设置好,但我需要向黄色节点添加一个开关,如下所示:
这是我目前得到的代码:
\begin{circuitikz}[american]
\draw (0,0) to[battery1 = \SI{12}{\volt}] (0,3)
to[short, -*] (2,3);
\draw (2,3) to[short] (2,4)
to[R=\SI{100}{\ohm}] (5,4) to[short, -*] (5,3);
\draw (2,3) to[short] (2,2)
to[R=\SI{60}{\ohm}] (5,2) -* (5,3);
\draw (5,3) to[short, -*, ] (7,3)
to[american inductor = \SI{2}{\mu \henry}] (7,0);
\draw (7,3) -- (10,3)
to[capacitor = \SI{3}{m\farad}] (10,0);
\draw (0,0) to[short, -*] (7,0) to[short, -*] (10,0);
;\end{circuitikz}
提前致谢!!
答案1
基于我可爱的开关绘图,你可以做这样的事情:
\documentclass{standalone}
\usepackage[siunitx,american]{circuitikz}
\begin{document}
\begin{circuitikz}
% Switch first, as we need coordinates
\draw node[cute spdt mid,rotate=215] (S) {};
\node at (S-in) [above] {S};
\node at (S-out 1) [left] {b};
\node at (S-out 2) [above] {a};
% Main circuit
\draw (S-in) to[short] ++(2,0)
to[capacitor = \SI{3}{\milli\farad}] ++(0,-3) coordinate (R)
to[short, *-] (S-out 1 |- R)
to[short, *-] ++(-7,0)
to[battery1 = \SI{12}{\volt}] ++(0,3)
to[short, -*] ++(2,0) coordinate (L)
to[short] ++(0,1)
to[R=\SI{100}{\ohm}] ++(3,0)
to[short, -*] ++(0,-1)
to[short] (S-out 2)
% Inductor branch
(S-out 1) to[L = \SI{2}{\micro\henry}] (S-out 1 |- R)
% Secondary resistor branch
(L) to[short] ++(0,-1)
to[R=\SI{60}{\ohm}] ++(3,0)
to[short] ++(0,1);
\end{circuitikz}
\end{document}
由于 circuitikz 中开关方向的限制(通常是左/右,这里旋转了 215 度),我们必须使用内部节点(S-*
)。我还使用(node1 |- node2)
语法自动获取交叉点。如果您有任何不清楚的地方,请随时在评论中提问。