Skip to main content
made the code more "idiomatic LaTeX"
Source Link
Mico
  • 557.9k
  • 57
  • 762
  • 1.3k

I have found a solution for calculation ofcalculating the impedance of a RLC circuitscircuit using the luacomplex package. For example, I have given a solution for series RLC circuit.

% !TEX TS-program = lualatex
    \documentclass{article}
\usepackage{amsmath} % for 'align*' environment
\usepackage{siunitx} % for '\qty' macro
  and '\unit' macros
\usepackage{luacomplex}
    \usepackage[nomessages]{fp}%
    \usepackage{circuitikz}
    \ctikzset{bipoles/thickness=1.2}
    \usepackage{enumitem}
     
\begin{document} 

    %\renewcommand{\imgUnit}{\mathrm{j}}
    \def\R{10}
    \def\L{0.1}
    \def\C{0.0001}
    \def\f{50}
    \FPeval{\omega}{2*pi*\f}%
    \cpxNew{R}{\R,0}
    \cpxNew{X_L}{0,\omega*\L}
    \FPeval{\xc}{1/(\omega*\C)}%
    \cpxNew{X_C}{0,-\xc}
    
    \cpxOp{Z}{R+X_L+X_C}
    
    \section{Introduction}
     
This document calculates the impedance of a series and parallel R-L-C circuits with resistive, inductive, and capacitive components.
    
    \section{Parameters}
     
\begin{itemize}[noitemsep]
        \item Resistance  $R = \qty{\R}{\ohm}$
        \item Inductance  $L = \qty{\L}{\henry}$
        \item Capacitance $C = \qty{\C}{\farad}$
        \item Frequency   $f = \qty{\f}{\hertz}$
    \end{itemize}
    
    \subsection{Series R-L-C Circuit}
    \begin{center}
    \begin{figure}[h!]
    \begin{circuitikz}
            \centering
        \begin{circuitikz}
    \draw[line width=1]
             (1,4) to [sinusoidal voltage source, l_=$V_S$, i=$I$] (1,1)
             (1,4) to [resistor, l_=$R$] ++(6,0) to [inductor, l_=$L$] ++(0,-4) to [capacitor, l_=$C$] +(-6,0) to [short](1,0) to [short](1,1);
    %\draw[help lines] (0,0) grid (10,10)   ;
        \end{circuitikz}
        \end{figure}
    \end{center}
    
    In a series RLC circuit, the total impedance $Z$ can be calculated using the formula:
    $$Z=R+j\[Z=R+j(X_L-X_C)$$
   \] 
    Calculate Inductive Reactance ($X_L$):
    $$X_L=2\pi\[X_L=2\pi f L$$
  L\]  
    Calculate Capacitive Reactance ($X_C$ ):
    $$X_C=\dfrac\[X_C=\frac{1}{2\pi f C}$$
    \]
    For the values ​​given above, the results are obtained aswe follows.find:
    \begin{align*}
  R  \noindent \(R=\cpxPrint{R}\)&= $\qty\qty{\R}{\ohm}$\\ 
 \\ 
X_L &= \(X_L=\cpxPrint\cpxPrint{X_L}\) $\qty{}\,\unit{\ohm}$\\
  \\
X_C &= \(X_C=\cpxPrint\cpxPrint{X_C}\) $\qty{}\,\unit{\ohm}$\\
    \cpxOp{Z}{R+X_L+X_C}\\
Z   &= \R+X_L+X_C=(Z=R+X_L+X_C=\cpxPrint\cpxPrint{Z}\) $\qty\,\unit{\ohm}\,.
\end{\ohmalign*}$
    
    \subsection{Parallel R-L-C Circuit}
     
In a parallel RLC circuit, the total impedance $Z$ can be calculated using the formula:
    $$\dfrac\[
\frac{1}{Z}=\dfrac=\frac{1}{R}+\dfrac+\frac{1}{jX_L}+\dfrac+\frac{1}{jX_C}$$\,.
    \]

\end{document}

enter image description hereenter image description here enter image description here

I have found a solution for calculation of impedance of a RLC circuits using luacomplex package. For example, I have given a solution for series RLC circuit.

% !TEX TS-program = lualatex
    \documentclass{article}
    \usepackage{siunitx} % for '\qty' macro
    \usepackage{luacomplex}
    \usepackage[nomessages]{fp}%
    \usepackage{circuitikz}
    \ctikzset{bipoles/thickness=1.2}
    
    \begin{document}
    %\renewcommand{\imgUnit}{\mathrm{j}}
    \def\R{10}
    \def\L{0.1}
    \def\C{0.0001}
    \def\f{50}
    \FPeval{\omega}{2*pi*\f}%
    \cpxNew{R}{\R,0}
    \cpxNew{X_L}{0,\omega*\L}
    \FPeval{\xc}{1/(\omega*\C)}%
    \cpxNew{X_C}{0,-\xc}
    
    
    
    \section{Introduction}
    This document calculates the impedance of a series and parallel R-L-C circuits with resistive, inductive, and capacitive components.
    
    \section{Parameters}
    \begin{itemize}
        \item Resistance  $R = \qty{\R}{\ohm}$
        \item Inductance  $L = \qty{\L}{\henry}$
        \item Capacitance $C = \qty{\C}{\farad}$
        \item Frequency   $f = \qty{\f}{\hertz}$
    \end{itemize}
    
    \subsection{Series R-L-C Circuit}
    \begin{center}
    \begin{figure}[h!]
    \begin{circuitikz}
            \centering
            \draw[line width=1]
             (1,4) to [sinusoidal voltage source, l_=$V_S$, i=$I$] (1,1)
             (1,4) to [resistor, l_=$R$] ++(6,0) to [inductor, l_=$L$] ++(0,-4) to [capacitor, l_=$C$] +(-6,0) to [short](1,0) to [short](1,1);
    %\draw[help lines] (0,0) grid (10,10)   ;
        \end{circuitikz}
        \end{figure}
    \end{center}
    
    In a series RLC circuit, the total impedance $Z$ can be calculated using the formula:
    $$Z=R+j(X_L-X_C)$$
    
    Calculate Inductive Reactance ($X_L$):
    $$X_L=2\pi f L$$
    
    Calculate Capacitive Reactance ($X_C$ ):
    $$X_C=\dfrac{1}{2\pi f C}$$
    
    For the values ​​given above, the results are obtained as follows.
    
    \noindent \(R=\cpxPrint{R}\) $\qty{}{\ohm}$\\ 
    \(X_L=\cpxPrint{X_L}\) $\qty{}{\ohm}$\\
    \(X_C=\cpxPrint{X_C}\) $\qty{}{\ohm}$\\
    \cpxOp{Z}{R+X_L+X_C}
    \(Z=R+X_L+X_C=\cpxPrint{Z}\) $\qty{}{\ohm}$
    
    \subsection{Parallel R-L-C Circuit}
    In a parallel RLC circuit, the total impedance $Z$ can be calculated using the formula:
    $$\dfrac{1}{Z}=\dfrac{1}{R}+\dfrac{1}{jX_L}+\dfrac{1}{jX_C}$$
    \end{document}

enter image description here

I have found a solution for calculating the impedance of a RLC circuit using the luacomplex package. For example, I have a solution for series RLC circuit.

% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{amsmath} % for 'align*' environment
\usepackage{siunitx} % for '\qty' and '\unit' macros
\usepackage{luacomplex}
\usepackage[nomessages]{fp}
\usepackage{circuitikz}
\ctikzset{bipoles/thickness=1.2}
\usepackage{enumitem}
     
\begin{document} 

    %\renewcommand{\imgUnit}{\mathrm{j}}
    \def\R{10}
    \def\L{0.1}
    \def\C{0.0001}
    \def\f{50}
    \FPeval{\omega}{2*pi*\f}%
    \cpxNew{R}{\R,0}
    \cpxNew{X_L}{0,\omega*\L}
    \FPeval{\xc}{1/(\omega*\C)}%
    \cpxNew{X_C}{0,-\xc}
    \cpxOp{Z}{R+X_L+X_C}

\section{Introduction}
 
This document calculates the impedance of series and parallel R-L-C circuits with resistive, inductive, and capacitive components.

\section{Parameters}
 
\begin{itemize}[noitemsep]
    \item Resistance  $R = \qty{\R}{\ohm}$
    \item Inductance  $L = \qty{\L}{\henry}$
    \item Capacitance $C = \qty{\C}{\farad}$
    \item Frequency   $f = \qty{\f}{\hertz}$
\end{itemize}

\subsection{Series R-L-C Circuit}

    \begin{figure}[h!]
    \centering
    \begin{circuitikz}
    \draw[line width=1]
      (1,4) to [sinusoidal voltage source, l_=$V_S$, i=$I$] (1,1)
      (1,4) to [resistor, l_=$R$] ++(6,0) to [inductor, l_=$L$] ++(0,-4) to [capacitor, l_=$C$] +(-6,0) to [short](1,0) to [short](1,1);
    %\draw[help lines] (0,0) grid (10,10)   ;
    \end{circuitikz}
    \end{figure}

In a series RLC circuit, the total impedance $Z$ can be calculated using the formula:
\[Z=R+j(X_L-X_C)\] 
Calculate Inductive Reactance ($X_L$):
\[X_L=2\pi f L\]  
Calculate Capacitive Reactance ($X_C$):
\[X_C=\frac{1}{2\pi f C}\]
For the values ​​given above, we find:
\begin{align*}
R   &= \qty{\R}{\ohm} \\ 
X_L &= (\cpxPrint{X_L})\,\unit{\ohm} \\
X_C &= (\cpxPrint{X_C})\,\unit{\ohm} \\
Z   &= R+X_L+X_C=(\cpxPrint{Z})\,\unit{\ohm}\,.
\end{align*}
    
\subsection{Parallel R-L-C Circuit}
 
In a parallel RLC circuit, the total impedance $Z$ can be calculated using the formula:
\[
\frac{1}{Z}=\frac{1}{R}+\frac{1}{jX_L}+\frac{1}{jX_C}\,.
\]

\end{document}

enter image description here enter image description here

added 435 characters in body
Source Link
user270674
user270674

I have found a solution for calculation of impedance of a RLC circuits using luacomplex package. For example, I have given a solution for series RLC circuit.

% !TEX TS-program = lualatex
    \documentclass{article}
    \usepackage{siunitx} % for '\qty' macro
    \usepackage{luacomplex}
    \usepackage[nomessages]{fp}%
    \usepackage{circuitikz}
    \ctikzset{bipoles/thickness=1.2}
    
    \begin{document}
    %\renewcommand{\imgUnit}{\mathrm{j}}
    \def\R{10}
    \def\L{0.1}
    \def\C{0.0001}
    \def\f{50}
    \FPeval{\omega}{2*pi*\f}%
    \cpxNew{R}{\R,0}
    \cpxNew{X_L}{0,\omega*\L}
    \FPeval{\xc}{1/(\omega*\C)}%
    \cpxNew{X_C}{0,-\xc}
    
    
    
    \section{Introduction}
    This document calculates the impedance of a series and parallel R-L-C circuits with resistive, inductive, and capacitive components.
    
    \section{Parameters}
    \begin{itemize}
        \item Resistance  $R = \qty{\R}{\ohm}$
        \item Inductance  $L = \qty{\L}{\henry}$
        \item Capacitance $C = \qty{\C}{\farad}$
        \item Frequency   $f = \qty{\f}{\hertz}$
    \end{itemize}
    
    \subsection{Series R-L-C Circuit}
    \begin{center}
    \begin{figure}[h!]
    \begin{circuitikz}
            \centering
            \draw[line width=1]
             (1,4) to [sinusoidal voltage source, l_=$V_S$, i=$I$] (1,1)
             (1,4) to [resistor, l_=$R$] ++(6,0) to [inductor, l_=$L$] ++(0,-4) to [capacitor, l_=$C$] +(-6,0) to [short](1,0) to [short](1,1);
    %\draw[help lines] (0,0) grid (10,10)   ;
        \end{circuitikz}
        \end{figure}
    \end{center}
    
    In a series RLC circuit, the total impedance $Z$ can be calculated using the formula:
    $$Z=R+j(X_L-X_C)$$
    
    Calculate Inductive Reactance ($X_L$):
    $$X_L=2\pi f L$$
    
    Calculate Capacitive Reactance ($X_C$ ):
    $$X_C=\dfrac{1}{2\pi f C}$$
    
    For the values ​​given above, the results are obtained as follows.
    
    \noindent \(R=\cpxPrint{R}\) $\qty{}{\ohm}$\\ 
    \(X_L=\cpxPrint{X_L}\) $\qty{}{\ohm}$\\
    \(X_C=\cpxPrint{X_C}\) $\qty{}{\ohm}$\\
    \cpxOp{Z}{R+X_L+X_C}
    \(Z=R+X_L+X_C=\cpxPrint{Z}\) $\qty{}{\ohm}$
    
    \subsection{Parallel R-L-C Circuit}
    In a parallel RLC circuit, the total impedance $Z$ can be calculated using the formula:
    $$\dfrac{1}{Z}=\dfrac{1}{R}+\dfrac{1}{jX_L}+\dfrac{1}{jX_C}$$
    \end{document}
% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{siunitx} % for '\qty' macro
\usepackage{luacomplex}
\usepackage[nomessages]{fp}%
\usepackage{circuitikz}
\ctikzset{bipoles/thickness=1.2}

\begin{document}
%\renewcommand{\imgUnit}{\mathrm{j}}
\def\R{10}
\def\L{0.1}
\def\C{0.0001}
\def\f{50}
\FPeval{\omega}{2*pi*\f}%
\cpxNew{R}{\R,0}
\cpxNew{X_L}{0,\omega*\L}
\FPeval{\xc}{1/(\omega*\C)}%
\cpxNew{X_C}{0,-\xc}



\section{Introduction}
This document calculates the impedance of a series and parallel R-L-C circuits with resistive, inductive, and capacitive components.

\section{Parameters}
\begin{itemize}
    \item Resistance  $R = \qty{\R}{\ohm}$
    \item Inductance  $L = \qty{\L}{\henry}$
    \item Capacitance $C = \qty{\C}{\farad}$
    \item Frequency   $f = \qty{\f}{\hertz}$
\end{itemize}

\subsection{Series R-L-C Circuit}
\begin{center}
\begin{figure}[h!]
\begin{circuitikz}
        \centering
        \draw[line width=1]
         (1,4) to [sinusoidal voltage source, l_=$V_S$, i=$I$] (1,1)
         (1,4) to [resistor, l_=$R$] ++(6,0) to [inductor, l_=$L$] ++(0,-4) to [capacitor, l_=$C$] +(-6,0) to [short](1,0) to [short](1,1);
%\draw[help lines] (0,0) grid (10,10)   ;
    \end{circuitikz}
    \end{figure}
\end{center}

In a series RLC circuit, the total impedance $Z$ can be calculated using the formula:
$$Z=R+j(X_L-X_C)$$

Calculate Inductive Reactance ($X_L$):
$$X_L=2\pi f L$$

Calculate Capacitive Reactance ($X_C$ ):
$$X_C=\dfrac{1}{2\pi f C}$$

For the values ​​given above, the results are obtained as follows.

\noindent \(R=\cpxPrint{R}\) $\qty{}{\ohm}$\\ 
\(X_L=\cpxPrint{X_L}\) $\qty{}{\ohm}$\\
\(X_C=\cpxPrint{X_C}\) $\qty{}{\ohm}$\\
\cpxOp{Z}{R+X_L+X_C}
\(Z=R+X_L+X_C=\cpxPrint{Z}\) $\qty{}{\ohm}$

\subsection{Parallel R-L-C Circuit}
In a parallel RLC circuit, the total impedance $Z$ can be calculated using the formula:
$$\dfrac{1}{Z}=\dfrac{1}{R}+\dfrac{1}{jX_L}+\dfrac{1}{jX_C}$$
\end{document}

I have found a solution for calculation of impedance of a RLC circuits using luacomplex package. For example, I have given a solution for series RLC circuit.

% !TEX TS-program = lualatex
    \documentclass{article}
    \usepackage{siunitx} % for '\qty' macro
    \usepackage{luacomplex}
    \usepackage[nomessages]{fp}%
    \usepackage{circuitikz}
    \ctikzset{bipoles/thickness=1.2}
    
    \begin{document}
    %\renewcommand{\imgUnit}{\mathrm{j}}
    \def\R{10}
    \def\L{0.1}
    \def\C{0.0001}
    \def\f{50}
    \FPeval{\omega}{2*pi*\f}%
    \cpxNew{R}{\R,0}
    \cpxNew{X_L}{0,\omega*\L}
    \FPeval{\xc}{1/(\omega*\C)}%
    \cpxNew{X_C}{0,-\xc}
    
    
    
    \section{Introduction}
    This document calculates the impedance of a series and parallel R-L-C circuits with resistive, inductive, and capacitive components.
    
    \section{Parameters}
    \begin{itemize}
        \item Resistance  $R = \qty{\R}{\ohm}$
        \item Inductance  $L = \qty{\L}{\henry}$
        \item Capacitance $C = \qty{\C}{\farad}$
        \item Frequency   $f = \qty{\f}{\hertz}$
    \end{itemize}
    
    \subsection{Series R-L-C Circuit}
    \begin{center}
    \begin{figure}[h!]
    \begin{circuitikz}
            \centering
            \draw[line width=1]
             (1,4) to [sinusoidal voltage source, l_=$V_S$, i=$I$] (1,1)
             (1,4) to [resistor, l_=$R$] ++(6,0) to [inductor, l_=$L$] ++(0,-4) to [capacitor, l_=$C$] +(-6,0) to [short](1,0) to [short](1,1);
    %\draw[help lines] (0,0) grid (10,10)   ;
        \end{circuitikz}
        \end{figure}
    \end{center}
    
    In a series RLC circuit, the total impedance $Z$ can be calculated using the formula:
    $$Z=R+j(X_L-X_C)$$
    
    Calculate Inductive Reactance ($X_L$):
    $$X_L=2\pi f L$$
    
    Calculate Capacitive Reactance ($X_C$ ):
    $$X_C=\dfrac{1}{2\pi f C}$$
    
    For the values ​​given above, the results are obtained as follows.
    
    \noindent \(R=\cpxPrint{R}\) $\qty{}{\ohm}$\\ 
    \(X_L=\cpxPrint{X_L}\) $\qty{}{\ohm}$\\
    \(X_C=\cpxPrint{X_C}\) $\qty{}{\ohm}$\\
    \cpxOp{Z}{R+X_L+X_C}
    \(Z=R+X_L+X_C=\cpxPrint{Z}\) $\qty{}{\ohm}$
    
    \subsection{Parallel R-L-C Circuit}
    In a parallel RLC circuit, the total impedance $Z$ can be calculated using the formula:
    $$\dfrac{1}{Z}=\dfrac{1}{R}+\dfrac{1}{jX_L}+\dfrac{1}{jX_C}$$
    \end{document}
Source Link
user270674
user270674

% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{siunitx} % for '\qty' macro
\usepackage{luacomplex}
\usepackage[nomessages]{fp}%
\usepackage{circuitikz}
\ctikzset{bipoles/thickness=1.2}

\begin{document}
%\renewcommand{\imgUnit}{\mathrm{j}}
\def\R{10}
\def\L{0.1}
\def\C{0.0001}
\def\f{50}
\FPeval{\omega}{2*pi*\f}%
\cpxNew{R}{\R,0}
\cpxNew{X_L}{0,\omega*\L}
\FPeval{\xc}{1/(\omega*\C)}%
\cpxNew{X_C}{0,-\xc}



\section{Introduction}
This document calculates the impedance of a series and parallel R-L-C circuits with resistive, inductive, and capacitive components.

\section{Parameters}
\begin{itemize}
    \item Resistance  $R = \qty{\R}{\ohm}$
    \item Inductance  $L = \qty{\L}{\henry}$
    \item Capacitance $C = \qty{\C}{\farad}$
    \item Frequency   $f = \qty{\f}{\hertz}$
\end{itemize}

\subsection{Series R-L-C Circuit}
\begin{center}
\begin{figure}[h!]
\begin{circuitikz}
        \centering
        \draw[line width=1]
         (1,4) to [sinusoidal voltage source, l_=$V_S$, i=$I$] (1,1)
         (1,4) to [resistor, l_=$R$] ++(6,0) to [inductor, l_=$L$] ++(0,-4) to [capacitor, l_=$C$] +(-6,0) to [short](1,0) to [short](1,1);
%\draw[help lines] (0,0) grid (10,10)   ;
    \end{circuitikz}
    \end{figure}
\end{center}

In a series RLC circuit, the total impedance $Z$ can be calculated using the formula:
$$Z=R+j(X_L-X_C)$$

Calculate Inductive Reactance ($X_L$):
$$X_L=2\pi f L$$

Calculate Capacitive Reactance ($X_C$ ):
$$X_C=\dfrac{1}{2\pi f C}$$

For the values ​​given above, the results are obtained as follows.

\noindent \(R=\cpxPrint{R}\) $\qty{}{\ohm}$\\ 
\(X_L=\cpxPrint{X_L}\) $\qty{}{\ohm}$\\
\(X_C=\cpxPrint{X_C}\) $\qty{}{\ohm}$\\
\cpxOp{Z}{R+X_L+X_C}
\(Z=R+X_L+X_C=\cpxPrint{Z}\) $\qty{}{\ohm}$

\subsection{Parallel R-L-C Circuit}
In a parallel RLC circuit, the total impedance $Z$ can be calculated using the formula:
$$\dfrac{1}{Z}=\dfrac{1}{R}+\dfrac{1}{jX_L}+\dfrac{1}{jX_C}$$
\end{document}

enter image description here