3

could you help me to change the following code to the figure which I have attached?

\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}

enter image description here

1
  • Annotation Z_2 is confusing, you are referring to the impedance of the line segment or the impedance of the two parallel components? In my understanding, Z_2 is zero ohm because we assume the line segment is a pure conductor. Hmm... Commented May 12, 2021 at 2:35

2 Answers 2

6

enter image description here

\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}
1
  • 1
    Thank you Bibra.
    – Sadcow
    Commented May 12, 2021 at 2:16
6

For exercise:

\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}

enter image description here

Addendum: In the case, that you like to have cute inductance and solid capacitor's bars, then by considering of @Rmano comment below (@Rmano thank you very much for your help), the MWE can be:

\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}

enter image description here

7
  • ah yes -- but the tricky part was getting the solid lines for the capacitor -- had to refer the documentation for that -- also I doubt that ohm symbol is to be inserted once the values are split into real and imaginary parts -- the inductance needs to be spiral of course as required by the OP -- but still +1 for the exercise :)
    – js bibra
    Commented May 12, 2021 at 2:11
  • I am curious, is it possible to draw circuits without specifying explicitly the coordinates (x,y) ? We don't specify explicitly the coordinate when drawing flow chart, right? Commented May 12, 2021 at 2:32
  • 2
    @jsbibra, from OP MWE follows, that (s)he like american style of drawing (BTW, showed image is terrible poor quality), solid lines for capacitor symbol: why should be if element is optional? However, if you like to have this, then just replace existed drawing of load by \draw[densely dashed, shorten <>=2pt] (aux3) -| ++ (1,-1.3) coordinate (c1); \draw[densely dashed, shorten <>=2pt] (aux0 -| aux3) -| ++ (1,1.3) coordinate (c2); \draw (c1) to[C=$-j\SI{5}{\ohm}$,bipoles/thickness=3] (c2);, where shorten <>/.style = {shorten <=#1, shorten >=#1}
    – Zarko
    Commented May 12, 2021 at 2:54
  • @KimJongUn, for bipole elements you need to use one of coordinate sistem: absolute, or relative For more details see or mix of bot as is used in mine answer. For nodes you can stick in their placement as you use in drawing flowcharts. For more details see package documentation.
    – Zarko
    Commented May 12, 2021 at 3:01
  • Thank you very much! Commented May 12, 2021 at 3:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .