您能帮我将下面的代码改为我所附的图吗?
\documentclass{article}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage[american]{circuitikz}
\begin{document}
\begin{figure}
\centering
\begin{circuitikz}
\draw (0,3)
to[V,v<=$V_s$] (0,0)
(0,3) to[ R, R=$ \SI{4.5}{\ohm}$] (3,3)
(3,3) to[ L=$j\SI{1.5}{\ohm}$] (6,3)
(0,2.2) to[ open, v=$V$] (6.5,2.2)
(6,3) to [R=$ \SI{25}{\ohm}$] (6,0)
(6,3) to[short] (8,3)
(8,3) to [L=$ j\SI{20}{\ohm}$] (8,0)
(8,3) to[short, -*] (10,3)
(10,0) to[short, *-] (0,0)
(10.2,3) to[ open, v=$V_o$] (10.2,0)
(6,0) to[short] (0,0);
\end{circuitikz}
\end{figure}
\end{document}
答案1
\documentclass[a4paper]{article}
\usepackage[siunitx ]{circuitikz}
\usetikzlibrary{positioning, arrows.meta, calc}
\usetikzlibrary{decorations.pathreplacing,calligraphy}
\begin{document}
\begin{circuitikz}
\draw
(0,3) to[american voltages, V, v_=$V_s$, ] (0,0)
(0,3) coordinate(c) to[ R, R=$ {4.5}$] (2,3)
to[ L=$j{1.5}$] (4,3) coordinate(d)
to[short, -*] (4,3)
to [R=$ {25}$] (4,0) coordinate(e)
to[short, -*] (4,0)
(4,3) to[short, -*] (6,3)
to [L=$ j{20}$] (6,0) coordinate(f)
to[short, -*] (6,0)
(6,3) to[short, -o] (8,3) coordinate(g);
\draw
(10,1.5) coordinate(a) to [C=$-j{5}$] ++ (0,0.3) coordinate(b);
\draw[dashed]
(8,3) to[short] (10,3)
to (b);
\draw[dashed]
(a) to[short] (10,0)
to (8,0);
\draw
(8,0) coordinate(h) to[short, o-] (0,0);
\draw [decorate, decoration={calligraphic brace, mirror,amplitude=8pt}] ($(c.south)+(0.5,-4pt)$) -- node[below=2ex] {$Z_1$} ($(d.south)+(-0.5,-4pt)$);
\draw [decorate, decoration={calligraphic brace, mirror,amplitude=8pt}] ($(e.south)+(0,-4pt)$) -- node[below=2ex] {$Z_2$} ($(f.south)+(0,-4pt)$);
\node[below=1ex] at (8,3) (){+};
\node[above=1ex] at (8,0) (){--};
\node at( $(g)!0.5!(h) $)(){$V_0$};
\end{circuitikz}
\end{document}
答案2
对于锻炼:
\documentclass[border=3.141592]{standalone}
\usepackage{siunitx}
\usepackage[american]{circuitikz}
\usetikzlibrary{decorations.pathreplacing,
calligraphy}
\tikzset{BC/.style args = {#1/#2}{decorate,
decoration={calligraphic brace, amplitude=2mm,
pre =moveto, pre length=2mm,
post=moveto, post length=2mm,
raise=#1,
#2},% for mirroring of brace
thick,
pen colour=red}
}
\ctikzset{bipoles/capacitor/height=0.5,
bipoles/capacitor/width=0.1,
}
\begin{document}
\begin{circuitikz}
\draw (0,3) to[V, a=$V_s$] (0,0) coordinate (aux0)
(0,3) to[R=$\SI{4.5}{\ohm}$] ++ (2,0)
to[L=$j\SI{1.5}{\ohm}$] ++ (2,0) coordinate (aux1)
to[R=$\SI{25}{\ohm}$,*-*] ++ (0,-3)
(aux1) -- ++ (1.5,0) coordinate (aux2)
to[L=$j\SI{20}{\ohm}$,*-*] ++ (0,-3)
(aux2) to[short,-o] ++ (2, 0) coordinate[label=$a$] (aux3)
to[open, v=$V_o$] ++ (0,-3) node[below] {$b$}
to[short,o-] (aux0);
\draw[densely dashed]
(aux3) to [short,o-] ++ (1,0)
to[C=$-j\SI{5}{\ohm}$] ++ (0,-3)
to [short,-o] (aux0 -| aux3);
\draw[BC=3mm/mirror]
(0,3) -- node[below=5mm] {$Z_1$} (aux1);
\draw[BC=1mm/mirror]
([xshift=-4mm] aux0 -| aux1) -- node[below=3mm] {$Z_2$} ([xshift=4mm] aux0 -| aux2);
\end{circuitikz}
\end{document}
附录:
如果您喜欢cute inductance
固体电容器的条形图,那么通过考虑下面的@Rmano 评论(@Rmano 非常感谢您的帮助),MWE 可以是:
\documentclass[border=3.141592]{standalone}
\usepackage{siunitx}
\usepackage[american, cute inductors]{circuitikz} % <---
\usetikzlibrary{decorations.pathreplacing,
calligraphy}
\tikzset{BC/.style args = {#1/#2}{decorate,
decoration={calligraphic brace, amplitude=2mm,
pre =moveto, pre length=2mm,
post=moveto, post length=2mm,
raise=#1,
#2},% for mirroring of brace
thick,
pen colour=red},
}
\ctikzset{bipoles/capacitor/height=0.5,
bipoles/capacitor/width=0.1,
}
\begin{document}
\begin{circuitikz}
\draw (0,3) to[V, a=$V_s$] (0,0) coordinate (aux0)
(0,3) to[R=$\SI{4.5}{\ohm}$] ++ (2,0)
to[L=$j\SI{1.5}{\ohm}$] ++ (2,0) coordinate (aux1)
to[R=$\SI{25}{\ohm}$,*-*] ++ (0,-3)
(aux1) -- ++ (1.5,0) coordinate (aux2)
to[L=$j\SI{20}{\ohm}$,*-*] ++ (0,-3)
(aux2) to[short,-o] ++ (2, 0) coordinate[label=$a$] (aux3)
to[open, v=$V_o$] ++ (0,-3) node[below] {$b$}
to[short,o-] (aux0);
% capacitor as capacitorshape node with dashed connections
\path (aux3) -- node (c) [right=10mm,
capacitorshape, fill=white, solid, rotate=90,
label=below:$-j\SI{5}{\ohm}$] {} (aux0 -| aux3);
\draw[densely dashed]
(aux3) to [short,o-] ++ (1,0) to (c.right)
(c.left)to (aux0 -| c) to [short,-o] (aux0 -| aux3);
%
\draw[BC=3mm/mirror]
(0,3) -- node[below=5mm] {$Z_1$} (aux1);
\draw[BC=1mm/mirror]
([xshift=-4mm] aux0 -| aux1) -- node[below=3mm] {$Z_2$} ([xshift=4mm] aux0 -| aux2);
\end{circuitikz}
\end{document}