我想要绘制一个具有电感耦合的电路,如下图所示:
我现在需要的是放置与电感耦合相关的点以及电源线。我认为如果它们是平的,我可以使用 TikZ 绘制这些点,但由于它们是波浪形的,我不知道该怎么做。
这是我到目前为止写的代码(我在两个耦合电感之间放了两行):
\documentclass[border=2pt]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{figure}
\centering
\begin{circuitikz}
\draw (0,0) to [short,o-o] (8,0);
\draw (0,1.5) to [short,o-] (3,1.5);
\draw (5,1.5) to [short,-o] (8,1.5);
\draw (3,1.5) to [inductor] (5,1.5);
\draw (6,2.5) to [short] (5,2.5) to [inductor] (3,2.5) to [short] (2,2.5) to [short] (2,3.5) to [C] (6,3.5) to [short] (6,2.5);
\draw (2,3.5) to [short] (2,4.5) to [inductor] (6,4.5) to [short] (6,3.5);
\draw (2,4.5) to [short] (2,5.5) to [resistor] (6,5.5) to [short] (6,4.5);
\draw[-] (3.5,1.95) -- (4.5,1.95) node{};
\draw[-] (3.5,2.05) -- (4.5,2.05) node{};
\end{circuitikz}
\end{figure}
\end{document}
我怎样才能完成这幅画?
谢谢。
答案1
要绘制“波浪”线,您可以使用库snake
提供的线条图案decorations.pathmorphing
。使用segment length
和amplitude
参数来获得所需的精确线条样式。
代码
\documentclass[border=2pt]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{tikzmark,decorations.pathmorphing}
\begin{document}
\begin{circuitikz}
\draw (0,0) to [short,o-o] (8,0);
\draw (0,1.5) to [short,o-] (3,1.5);
\draw (5,1.5) to [short,-o] (8,1.5);
\draw (3,1.5) to [inductor] (5,1.5);
\draw (6,2.5) to [short] (5,2.5) to [inductor] (3,2.5) to [short] (2,2.5) to [short] (2,3.5) to [C] (6,3.5) to [short] (6,2.5);
\draw (2,3.5) to [short] (2,4.5) to [inductor] (6,4.5) to [short] (6,3.5);
\draw (2,4.5) to [short] (2,5.5) to [resistor] (6,5.5) to [short] (6,4.5);
\draw[-] (3.5,1.95) -- (4.5,1.95) node{};
\draw[-] (3.5,2.05) -- (4.5,2.05) node{};
% wavy lines
\draw[->,decorate,decoration={snake,segment length=30pt,amplitude=4pt}](0,.75)--(2,.75);
\draw[->,decorate,decoration={snake,segment length=30pt,amplitude=4pt}](6,.75)--(8,.75);
\end{circuitikz}
\end{document}
输出
答案2
您还可以使用 PSTricks:
\documentclass{article}
\usepackage{pst-circ,pst-plot}
\newcommand*\CurvedArrow[4]{
\rput(#1,0){
\psplot[algebraic]{0}{#2}{#3*sin(6*x)+#4}
\psline{->}(#2,#4)(!#2 0.15 add #4)
}
}
\begin{document}
\begin{pspicture}(-0.4,-0.1)(7.3,8.8)
\wire[arrows=*-*](0,0)(7,0)
\coil[arrows=*-*](0,2)(7,2){}
\coil(6,3.5)(1,3.5){}
\psline(2.5,2.75)(4.5,2.75)
\capacitor[arrows=*-*](1,5)(6,5){$C$}
\coil[arrows=*-*](1,6.5)(6,6.5){$L$}
\resistor[dipolestyle=zigzag](1,8)(6,8){$R$}
\wire(1,3.5)(1,8)
\wire(6,3.5)(6,8)
\psdots[dotsize=2pt](5.5,2.15)(5.5,3.65)
\rput(6.2,2.15){$n$}
\rput(6.2,3.65){$l$}
\CurvedArrow{-0.4}{1.05}{0.2}{1}
\CurvedArrow{6.1}{1.05}{0.2}{1}
\end{pspicture}
\end{document}
它几乎肯定可以变得更简单,但这是我的第一次尝试。
答案3
对于电感器的耦合,我会这样做:
\documentclass{article}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz} \draw
(0,0) node[transformer] (T) {}
(T.A1) node[above] {A1}
(T.B2) node[anchor=west] {B2}
(T.A1) node[below right=2mm] {$\bullet$}
(T.B2) node[above left=2mm] {$\bullet$}
(T.A1) -| (-1.5,1) to[C] (-3,1) |- (T.A2)
;\end{circuitikz}
\end{document}