JET 65 ANALYSIS OF THE INFLUENCE OF PARAMETERS WHEN CHARGING AND DISCHARGING A CAPACITOR USING DIFFERENTIAL EQUATIONS ANALIZA VPLIVA PARAMETROV PRI POLNJENJU IN PRAZNJENJU KONDENZATORJA Z UPORABO DIFERENCIALNIH ENAČB Matic Krašovic ℜ , Peter Virtič 1 Keywords: RC circuit, RLC circuit, state space, transfer function, differential equations, parame- ters R, L, C, damping Abstract Two different electrical circuits were analysed in this paper. The first was an RC circuit consisting of a resistor R, a capacitor C, and a DC voltage u, while the second was an RLC circuit consisting of a resistor R, a capacitor C, a DC voltage u and an inductor L. Both circuits were described using the state space mathematical model and, on this basis, graphs for charging and discharging a capacitor were plotted. Both circuits were described using differential equations for electrical current through a capacitor and voltage over a capacitor. Finally, different values of the R (re- sistance), L (inductance) and C (capacitance) parameters were taken, and graphs were plotted for voltage over capacitor. The purpose of the study was to explore how different values of parame- ters influence capacitor charging and discharging. JET Volume 15 (2022) p.p. 65-80 Issue 2, 2022 Type of article: 1.01 www.fe.um.si/si/jet.html ℜ Corresponding author: Matic Krašovic, University of Maribor, Faculty of Energy Technology, Hočevarjev trg 1, 8270 Krško, Slovenia, Email: matic.krasovic@student.um.si 1 University of Maribor, Faculty of Energy Technology Analysis of the influence of parameters when charging and discharging a capacitor using differential equations Analiza vpliva parametrov pri polnjenju in praznjenju kondenzatorja z uporabo diferencialnih enačb Matic Krašovic, Peter Virtič 66 JET 66 JET Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 Povzetek V tem članku sta bili analizirani dve različni električni vezji. Prvo je bilo RC vezje, sestavljeno iz upora R, kondenzatorja C in enosmerne napetosti u. Drugo je bilo RLC vezje, ki je bilo podobno prejšnjemu vezju, le da je bila dodana tuljava L. Obe vezji sta bili pretvorjeni v matematični model v prostoru stanj in na podlagi tega so bili izrisani različni grafi za polnjenje in praznjenje konden- zatorja. Obe vezji sta opisani z diferencialnimi enačbami za električni tok skozi kondenzator in napetost na kondenzatorju. Na koncu so bile izbrane različne vrednosti parametrov R (uporno- sti), L (induktivnosti) in C (kapacitivnosti) in na podlagi tega so bili izrisani grafi za napetost na kondenzatorju. Namen je bil videti, kako različne vrednosti parametrov vplivajo na polnjenje in praznjenje kondenzatorja. 1 INTRODUCTION Nowadays, different electrical circuits can be found almost everywhere. Analysing these circuits and describing them mathematically, as well as seeing what is actually going on inside them, can really help engineers to better understand such circuits. This was among the purposes of this article, i.e. to describe two different circuits in detail using differential equations and state space. A state space is a mathematical notation of a circuit in the form of matrices, where differential equations are pre-existing, and is a straightforward way to describe the response of the system. Below there are two simple equations that will be used later in this paper, which demonstrate that they have a derivative in it: 2 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- for voltage over capacitor. The purpose of the study was to explore how different values of parameters influence capacitor charging and discharging. Povzetek V tem članku sta bili analizirani dve različni električni vezji. Prvo je bilo RC vezje, sestavljeno iz upora R, kondenzatorja C in enosmerne napetosti u. Drugo je bilo RLC vezje, ki je bilo podobno prejšnjemu vezju, le da je bila dodana tuljava L. Obe vezji sta bili pretvorjeni v matematični model v prostoru stanj in na podlagi tega so bili izrisani različni grafi za polnjenje in praznjenje kondenzatorja. Obe vezji sta opisani z diferencialnimi enačbami za električni tok skozi kondenzator in napetost na kondenzatorju. Na koncu so bile izbrane različne vrednosti parametrov R (upornosti), L (induktivnosti) in C (kapacitivnosti) in na podlagi tega so bili izrisani grafi za napetost na kondenzatorju. Namen je bil videti, kako različne vrednosti parametrov vplivajo na polnjenje in praznjenje kondenzatorja. 1 INTRODUCTION Nowadays, different electrical circuits can be found almost everywhere. Analysing these circuits and describing them mathematically, as well as seeing what is actually going on inside them, can really help engineers to better understand such circuits. This was among the purposes of this article, i.e. to describe two different circuits in detail using differential equations and state space. A state space is a mathematical notation of a circuit in the form of matrices, where differential equations are pre-existing, and is a straightforward way to describe the response of the system. Below there are two simple equations that will be used later in this paper, which demonstrate that they have a derivative in it: 𝑖𝑖 � = 𝐶𝐶 �� � �� (1.1) 𝑢𝑢 � = 𝐿𝐿 �� � �� (1.2) When these equations are used as a part of a system of equations necessary to obtain a solution, a differential equation is obtained. In [1] the authors discussed RLC circuits with resonant frequency and bandwidth, while in [2] the authors described RLC circuits using system theoretic properties with differential equations and matrices. In [3] the authors compared parameters and their influence on the streamer discharge process of a gas park switch in a series RC circuit, and in [4] the authors used a mathematical approach of optimised waveform relaxation for a small RC circuit. Numerous models in the form of matrices were also used. In [5] the authors introduced capacitor charging and discharging through the Ohm and Kirchhoff Laws using charge and capacitance. In comparison with the authors in [1] and [2], the authors of this paper used a similar approach, albeit an analytical and numerical one, including the use of differential equations and matrices for capacitor charging and discharging in an RLC circuit. In order to compare this paper with that of the authors in [3], one of the main themes is the influence of parameters; the difference being that the authors [3] used a slightly different approach and plotted different graphs. In comparison to the authors in [4], the authors of this paper also used a mathematical approach, with more for voltage and electrical current through capacitor and less for waveform relaxation. Finally, the greatest similarity of this paper is to that of author [5], who used charge q and capacitance C to (1.1) 2 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- plotted for voltage over capacitor . The purpose of the study was to explore how different values of parameters influence capacitor charging and discharging. P o v ze te k V tem članku sta bili analizirani dve različni električni vezji. Prvo je bilo RC vezje, sestavljeno iz upora R, kondenzatorja C in enosmerne napetosti u. Drugo je bilo RLC vezje, ki je bilo podobno prejšnjemu vezju, le da je bila dodana tuljava L. Obe vezji sta bili pretvorjeni v matematični model v prostoru stanj in na podlagi tega so bili izrisani različni grafi za polnjenje in praznjenje kondenzatorja. Obe vezji sta opisani z diferencialnimi enačbami za električni tok skozi kondenzator in napetost na kondenzatorju. Na koncu so bile izbrane različne vrednosti parametrov R (upornosti), L (induktivnosti) in C (kapacitivnosti) in na podlagi tega so bili izrisani grafi za napetost na kondenzatorju. Namen je bil videti, kako različne vrednosti parametrov vplivajo na polnjenje in praznjenje kondenzatorja. 1 IN T R OD U C TION Nowadays, different electrical circuits can be found almost everywhere. Analysing these circuits and describing them mathematically, as well as seeing what is actually going on inside them, can really help engineers to better understand such circuits. This was among the purposes of this article, i.e. to describe two different circuits in detail using differential equations and state space. A state space is a mathematical notation of a circuit in the form of matrices, where differential equations are pre-existing, and is a straightforward way to describe the response of the system. Below there are two simple equations that will be used later in this paper , which demonstrate that they have a derivative in it: i c = C ⅆ u c ⅆt (1.1) u L = L ⅆ i L ⅆt (1.2) When these equations are used as a part of a system of equations necessary to obtain a solution, a differential equation is obtained. In [1] the authors discussed RLC circuits with resonant frequency and bandwidth, while in [2] the authors described RLC circuits using system theoretic properties with differential equations and matrices. In [3] the authors compared parameters and their influence on the streamer discharge process of a gas park switch in a series RC circuit, and in [4] the authors used a mathematical approach of optimised waveform relaxation for a small RC circuit. Numerous models in the form of matrices were also used. In [5] the authors introduced capacitor charging and discharging through the Ohm and Kirchhoff Laws using charge and capacitance. In comparison with the authors in [1] and [2], the authors of this paper used a similar approach, albeit an analytical and numerical one, including the use of differential equations and matrices for capacitor charging and discharging in an RLC circuit. In order to compare this paper with that of the authors in [3], one of the main themes is the influence of parameters; the difference being that the authors [3] used a slightly different approach and plotted different graphs. In (1.2) When these equations are used as a part of a system of equations necessary to obtain a solution, a differential equation is obtained. In [1] the authors discussed RLC circuits with resonant frequency and bandwidth, while in [2] the authors described RLC circuits using system theoretic properties with differential equations and matrices. In [3] the authors compared parameters and their influence on the streamer discharge process of a gas park switch in a series RC circuit, and in [4] the authors used a mathematical approach of optimised waveform relaxation for a small RC circuit. Numerous models in the form of matrices were also used. In [5] the authors introduced capacitor charging and discharging through the Ohm and Kirchhoff Laws using charge and capacitance. In comparison with the authors in [1] and [2], the authors of this paper used a similar approach, albeit an analytical and numerical one, including the use of differential equations and matrices for capacitor charging and discharging in an RLC circuit. In order to compare this paper with that of the authors in [3], one of the main themes is the influence of parameters; the difference being that the authors [3] used a slightly different approach and plotted different graphs. In compari- son to the authors in [4], the authors of this paper also used a mathematical approach, with more for voltage and electrical current through capacitor and less for waveform relaxation. Finally, the greatest similarity of this paper is to that of author [5], who used charge q and capacitance C to describe current through the capacitor in an RC circuit when being charged and discharged. This paper, however, has mostly electrical current i, voltage u and resistance R. JET 67 Analysis of the influence of parameters when charging and discharging a capacitor using differential equations In contrast to existing articles, the authors of this paper introduced RC and RLC circuit state space models in order to observe how the voltage over capacitor changes when different values of parameters are used. For instance, in the RLC circuit, when a bigger inductance L was used, the capacitor was charged with a higher overshoot and settling time. A more in-depth description of the impact of the parameters is found in the following sections. 2 RC CIRCUIT ANALYSIS 2.1 Analytical method Figure 1 shows an RC circuit consisting of a resistor R, a capacitor C and a DC supply u. Figure 1: RC circuit with a resistor R, capacitor C and a DC supply u At the beginning of charging, the capacitor should be empty so that u c =0V. When the supply is turned on, after a short time the capacitor becomes partially charged. By writing a loop for the voltages: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 3 ---------- describe current through the capacitor in an RC circuit when being charged and discharged. This paper, however, has mostly electrical current i, voltage u and resistance R. In contrast to existing articles, the authors of this paper introduced RC and RLC circuit state space models in order to observe how the voltage over capacitor changes when different values of parameters are used. For instance, in the RLC circuit, when a bigger inductance L was used, the capacitor was charged with a higher overshoot and settling time. A more in-depth description of the impact of the parameters is found in the following sections. 2 RC CIRCUIT ANALYSIS 2.1 Analytical method Figure 1 shows an RC circuit consisting of a resistor R, a capacitor C and a DC supply u. Figure 1: RC circuit with a resistor R, capacitor C and a DC supply u At the beginning of charging, the capacitor should be empty so that uc=0V. When the supply is turned on, after a short time the capacitor becomes partially charged. By writing a loop for the voltages: 𝑢𝑢𝑢𝑢𝑢 � +𝑢𝑢 � (2.1.1) and using a derivation, while knowing that: 𝑢𝑢 � 𝑢 𝑖𝑖𝑖𝑖𝑖 (2.1.2) and: 𝑖𝑖 � 𝑢𝐶𝐶 �� � �� (2.1.3) it is possible to solve a differential equation and get the electrical current through the capacitor: 𝑖𝑖𝑢 � � ⋅𝑒𝑒 � � � ⋅� (2.1.4) Where 𝑖𝑖 is the electrical current through the capacitor, u is the supply voltage, R is the resistance, e is the Euler constant, C is the capacitance and t is time. (2.1.1) and using a derivation, while knowing that: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 3 ---------- describe current through the capacitor in an RC circuit when being charged and discharged. This paper, however, has mostly electrical current i, voltage u and resistance R. In contrast to existing articles, the authors of this paper introduced RC and RLC circuit state space models in order to observe how the voltage over capacitor changes when different values of parameters are used. For instance, in the RLC circuit, when a bigger inductance L was used, the capacitor was charged with a higher overshoot and settling time. A more in-depth description of the impact of the parameters is found in the following sections. 2 RC CIRCUIT ANALYSIS 2.1 Analytical method Figure 1 shows an RC circuit consisting of a resistor R, a capacitor C and a DC supply u. Figure 1: RC circuit with a resistor R, capacitor C and a DC supply u At the beginning of charging, the capacitor should be empty so that uc=0V. When the supply is turned on, after a short time the capacitor becomes partially charged. By writing a loop for the voltages: 𝑢𝑢𝑢𝑢𝑢 � +𝑢𝑢 � (2.1.1) and using a derivation, while knowing that: 𝑢𝑢 � 𝑢 𝑖𝑖𝑖𝑖𝑖 (2.1.2) and: 𝑖𝑖 � 𝑢𝐶𝐶 �� � �� (2.1.3) it is possible to solve a differential equation and get the electrical current through the capacitor: 𝑖𝑖𝑢 � � ⋅𝑒𝑒 � � � ⋅� (2.1.4) Where 𝑖𝑖 is the electrical current through the capacitor, u is the supply voltage, R is the resistance, e is the Euler constant, C is the capacitance and t is time. (2.1.2) and: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 3 ---------- describe current through the capacitor in an RC circuit when being charged and discharged. This paper, however, has mostly electrical current i, voltage u and resistance R. In contrast to existing articles, the authors of this paper introduced RC and RLC circuit state space models in order to observe how the voltage over capacitor changes when different values of parameters are used. For instance, in the RLC circuit, when a bigger inductance L was used, the capacitor was charged with a higher overshoot and settling time. A more in-depth description of the impact of the parameters is found in the following sections. 2 RC CIRCUIT ANALYSIS 2.1 Analytical method Figure 1 shows an RC circuit consisting of a resistor R, a capacitor C and a DC supply u. Figure 1: RC circuit with a resistor R, capacitor C and a DC supply u At the beginning of charging, the capacitor should be empty so that uc=0V. When the supply is turned on, after a short time the capacitor becomes partially charged. By writing a loop for the voltages: 𝑢𝑢𝑢𝑢𝑢 � +𝑢𝑢 � (2.1.1) and using a derivation, while knowing that: 𝑢𝑢 � 𝑢 𝑖𝑖𝑖𝑖𝑖 (2.1.2) and: 𝑖𝑖 � 𝑢𝐶𝐶 �� � �� (2.1.3) it is possible to solve a differential equation and get the electrical current through the capacitor: 𝑖𝑖𝑢 � � ⋅𝑒𝑒 � � � ⋅� (2.1.4) Where 𝑖𝑖 is the electrical current through the capacitor, u is the supply voltage, R is the resistance, e is the Euler constant, C is the capacitance and t is time. (2.1.3) it is possible to solve a differential equation and get the electrical current through the capacitor: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 3 ---------- describe current through the capacitor in an RC circuit when being charged and discharged. This paper, however, has mostly electrical current i, voltage u and resistance R. In contrast to existing articles, the authors of this paper introduced RC and RLC circuit state space models in order to observe how the voltage over capacitor changes when different values of parameters are used. For instance, in the RLC circuit, when a bigger inductance L was used, the capacitor was charged with a higher overshoot and settling time. A more in-depth description of the impact of the parameters is found in the following sections. 2 RC CIRCUIT ANALYSIS 2.1 Analytical method Figure 1 shows an RC circuit consisting of a resistor R, a capacitor C and a DC supply u. Figure 1: RC circuit with a resistor R, capacitor C and a DC supply u At the beginning of charging, the capacitor should be empty so that uc=0V. When the supply is turned on, after a short time the capacitor becomes partially charged. By writing a loop for the voltages: 𝑢𝑢𝑢𝑢𝑢 � +𝑢𝑢 � (2.1.1) and using a derivation, while knowing that: 𝑢𝑢 � 𝑢 𝑖𝑖𝑖𝑖𝑖 (2.1.2) and: 𝑖𝑖 � 𝑢𝐶𝐶 �� � �� (2.1.3) it is possible to solve a differential equation and get the electrical current through the capacitor: 𝑖𝑖𝑢 � � ⋅𝑒𝑒 � � � ⋅� (2.1.4) Where 𝑖𝑖 is the electrical current through the capacitor, u is the supply voltage, R is the resistance, e is the Euler constant, C is the capacitance and t is time. (2.1.4) Where i is the electrical current through the capacitor, u is the supply voltage, R is the resistance, e is the Euler constant, C is the capacitance and t is time. The similar applies to the voltage over capacitor and, after solving it, the following is obtained: 4 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- The similar applies to the voltage over capacitor and, after solving it, the following is obtained: 𝑢𝑢 � =𝑢𝑢 �1−𝑒𝑒 � � �� � (2.1.5) The above was carried out analytically; the numerical method is described below. 2.1 Numerical method 2.1.1 MATLAB and State space First, a circuit needed to be modelled using the state space model, which was programmed in MATLAB. 𝑥𝑥 ̇ = 𝐴𝐴 𝑥𝑥 𝐴 𝐴𝐴𝑢𝑢 (2.1.1.1) 𝑦𝑦 =𝑦𝑦 � 𝑥𝑥 𝐴 𝑥𝑥𝑢𝑢 (2.1.1.2) [ 𝑥𝑥 ̇ 1 ] = � − 1 𝑅𝑅𝑅𝑅 � ∙ [ 𝑥𝑥 1 ] 𝐴 � 1 𝑅𝑅𝑅𝑅 � ∙𝑢𝑢 (2.1.1.3) y= [ 1 ] � ∙ [ 𝑥𝑥 � ] 𝐴0∙𝑢𝑢 (2.1.1.4) The matrices represent a mathematical notation, called state space. A is called the state or system matrix, b is the input matrix, c is the output matrix and d is a feedthrough or feedforward matrix. Based on this notation, graphs were plotted at the given values: R=1000Ω and C=1000e-6F. Figure 2: Charging and discharging of a capacitor in an RC circuit Graphs represent the transfer function of the system. As can be seen, when it is charging the voltage is higher over time and lower when discharging. (2.1.5) The above was carried out analytically; the numerical method is described below. 68 JET 68 JET Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 2.2 Numerical method 2.2.1 MATLAB and State space First, a circuit needed to be modelled using the state space model, which was programmed in MATLAB. 4 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- The similar applies to the voltage over capacitor and, after solving it, the following is obtained: 𝑢𝑢 � =𝑢𝑢 �1−𝑒𝑒 � � �� � (2.1.5) The above was carried out analytically; the numerical method is described below. 2.1 Numerical method 2.1.1 MATLAB and State space First, a circuit needed to be modelled using the state space model, which was programmed in MATLAB. 𝑥𝑥 ̇ = 𝐴𝐴 𝑥𝑥 𝐴 𝐴𝐴𝑢𝑢 (2.1.1.1) 𝑦𝑦 =𝑦𝑦 � 𝑥𝑥 𝐴 𝑥𝑥𝑢𝑢 (2.1.1.2) [ 𝑥𝑥 ̇ 1 ] = � − 1 𝑅𝑅𝑅𝑅 � ∙ [ 𝑥𝑥 1 ] 𝐴 � 1 𝑅𝑅𝑅𝑅 � ∙𝑢𝑢 (2.1.1.3) y= [ 1 ] � ∙ [ 𝑥𝑥 � ] 𝐴0∙𝑢𝑢 (2.1.1.4) The matrices represent a mathematical notation, called state space. A is called the state or system matrix, b is the input matrix, c is the output matrix and d is a feedthrough or feedforward matrix. Based on this notation, graphs were plotted at the given values: R=1000Ω and C=1000e-6F. Figure 2: Charging and discharging of a capacitor in an RC circuit Graphs represent the transfer function of the system. As can be seen, when it is charging the voltage is higher over time and lower when discharging. (2.2.1.1) 4 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- The similar applies to the voltage over capacitor and, after solving it, the following is obtained: 𝑢𝑢 � =𝑢𝑢 �1−𝑒𝑒 � � �� � (2.1.5) The above was carried out analytically; the numerical method is described below. 2.1 Numerical method 2.1.1 MATLAB and State space First, a circuit needed to be modelled using the state space model, which was programmed in MATLAB. 𝑥𝑥 ̇ = 𝐴𝐴 𝑥𝑥 𝐴 𝐴𝐴𝑢𝑢 (2.1.1.1) 𝑦𝑦 =𝑦𝑦 � 𝑥𝑥 𝐴 𝑥𝑥𝑢𝑢 (2.1.1.2) [ 𝑥𝑥 ̇ 1 ] = � − 1 𝑅𝑅𝑅𝑅 � ∙ [ 𝑥𝑥 1 ] 𝐴 � 1 𝑅𝑅𝑅𝑅 � ∙𝑢𝑢 (2.1.1.3) y= [ 1 ] � ∙ [ 𝑥𝑥 � ] 𝐴0∙𝑢𝑢 (2.1.1.4) The matrices represent a mathematical notation, called state space. A is called the state or system matrix, b is the input matrix, c is the output matrix and d is a feedthrough or feedforward matrix. Based on this notation, graphs were plotted at the given values: R=1000Ω and C=1000e-6F. Figure 2: Charging and discharging of a capacitor in an RC circuit Graphs represent the transfer function of the system. As can be seen, when it is charging the voltage is higher over time and lower when discharging. (2.2.1.2) 4 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- The similar applies to the voltage over capacitor and, after solving it, the following is obtained: 𝑢𝑢 � =𝑢𝑢 �1−𝑒𝑒 � � �� � (2.1.5) The above was carried out analytically; the numerical method is described below. 2.1 Numerical method 2.1.1 MATLAB and State space First, a circuit needed to be modelled using the state space model, which was programmed in MATLAB. 𝑥𝑥 ̇ = 𝐴𝐴 𝑥𝑥 𝐴 𝐴𝐴𝑢𝑢 (2.1.1.1) 𝑦𝑦 =𝑦𝑦 � 𝑥𝑥 𝐴 𝑥𝑥𝑢𝑢 (2.1.1.2) [ 𝑥𝑥 ̇ 1 ] = � − 1 𝑅𝑅𝑅𝑅 � ∙ [ 𝑥𝑥 1 ] 𝐴 � 1 𝑅𝑅𝑅𝑅 � ∙𝑢𝑢 (2.1.1.3) y= [ 1 ] � ∙ [ 𝑥𝑥 � ] 𝐴0∙𝑢𝑢 (2.1.1.4) The matrices represent a mathematical notation, called state space. A is called the state or system matrix, b is the input matrix, c is the output matrix and d is a feedthrough or feedforward matrix. Based on this notation, graphs were plotted at the given values: R=1000Ω and C=1000e-6F. Figure 2: Charging and discharging of a capacitor in an RC circuit Graphs represent the transfer function of the system. As can be seen, when it is charging the voltage is higher over time and lower when discharging. (2.2.1.3) 4 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- The similar applies to the voltage over capacitor and, after solving it, the following is obtained: 𝑢𝑢 � =𝑢𝑢 �1−𝑒𝑒 � � �� � (2.1.5) The above was carried out analytically; the numerical method is described below. 2.1 Numerical method 2.1.1 MATLAB and State space First, a circuit needed to be modelled using the state space model, which was programmed in MATLAB. 𝑥𝑥 ̇ = 𝐴𝐴 𝑥𝑥 𝐴 𝐴𝐴𝑢𝑢 (2.1.1.1) 𝑦𝑦 =𝑦𝑦 � 𝑥𝑥 𝐴 𝑥𝑥𝑢𝑢 (2.1.1.2) [ 𝑥𝑥 ̇ 1 ] = � − 1 𝑅𝑅𝑅𝑅 � ∙ [ 𝑥𝑥 1 ] 𝐴 � 1 𝑅𝑅𝑅𝑅 � ∙𝑢𝑢 (2.1.1.3) y= [ 1 ] � ∙ [ 𝑥𝑥 � ] 𝐴0∙𝑢𝑢 (2.1.1.4) The matrices represent a mathematical notation, called state space. A is called the state or system matrix, b is the input matrix, c is the output matrix and d is a feedthrough or feedforward matrix. Based on this notation, graphs were plotted at the given values: R=1000Ω and C=1000e-6F. Figure 2: Charging and discharging of a capacitor in an RC circuit Graphs represent the transfer function of the system. As can be seen, when it is charging the voltage is higher over time and lower when discharging. (2.2.1.4) The matrices represent a mathematical notation, called state space. A is called the state or system matrix, b is the input matrix, c is the output matrix and d is a feedthrough or feedforward matrix. Based on this notation, graphs were plotted at the given values: R=1000Ω and C=1000e-6F. Figure 2: Charging and discharging of a capacitor in an RC circuit Graphs represent the transfer function of the system. As can be seen, when it is charging the voltage is higher over time and lower when discharging. 2.2.2 MATLAB and Simulink A similar thing was done, again in MATLAB, but now with the addition of Simulink. Again, some calculations needed to be done. The loop, from section 1, had to be converted into a derivative of voltage over capacitor. After solving it, the following equation is obtained: JET 69 Analysis of the influence of parameters when charging and discharging a capacitor using differential equations Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 5 ---------- 2.1.2 MATLAB and Simulink A similar thing was done, again in MATLAB, but now with the addition of Simulink. Again, some calculations needed to be done. The loop, from section 1, had to be converted into a derivative of voltage over capacitor. After solving it, the following equation is obtained: �� � �� = � �� 𝑢𝑢𝑢 � �� 𝑢𝑢 � (2.1.2.1) Based on the previously derived differential equation, a block diagram was built in Simulink for this circuit. Figure 3: Simulink block diagram The code was written in MATLAB, connected to Simulink through the MATLAB ‘sim’ function, so that the code could work perfectly, based on the Simulink block diagram. The value of R was 1000Ω and that of C was 1000e-6F. The graphs that were plotted are: supply voltage u, voltage across capacitor and resistor and the electrical current through the capacitor. (2.2.2.1) Based on the previously derived differential equation, a block diagram was built in Simulink for this circuit. Figure 3: Simulink block diagram The code was written in MATLAB, connected to Simulink through the MATLAB ‘sim’ function, so that the code could work perfectly, based on the Simulink block diagram. The value of R was 1000Ω and that of C was 1000e-6F. The graphs that were plotted are: supply voltage u, voltage across capacitor and resistor and the electrical current through the capacitor. Figure 4: Voltages and current in the RC circuit 70 JET 70 JET Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 As can be seen above, at some point the voltage across the capacitor is the same as the supply voltage, which means it reached the highest voltage value. Thereafter, however, the capacitor starts discharging, and the voltage slowly falls to zero, as does the current. Another point to men- tion is the time constant τ (‘tao’). This constant represents the time when the capacitor is 63% charged, which can easily be calculated as τ = R∙C. In this case, R was 1000Ω and C was 1000e-6F. Therefore, when entered into the equation, τ is equal to 1s. However, since it started from t=1s, the graph shows that τ=2s, so the 1s needs to be subtracted from 2s, thus resulting in τ=1s. 3 RLC CIRCUIT ANALYSIS 3.1 Analytical method Figure 5 shows an RLC circuit consisting of a resistor R, a capacitor C, a DC-supply u and an indu- ctor L. Figure 5: RLC circuit with a resistor R, capacitor C, inductor L and a DC supply u Some equations needed to be written for the analytical approach. First, the loop for voltages: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 7 ---------- Figure 5: RLC circuit with a resistor R, capacitor C, inductor L and a DC supply u Some equations needed to be written for the analytical approach. First, the loop for voltages: 𝑢𝑢𝑢𝑢𝑢 � +𝑢𝑢 � +𝑢𝑢 � (3.1.1) A similar approach was used, as in the case of the RC circuit, but 𝑢𝑢 � was also used, which by definition is: 𝑢𝑢 � 𝑢𝐿𝐿 �� � �� (3.1.2) In order to consider everything and put it into an equation, a second order differential equation for the electrical current through the capacitor was solved: � � � � �� � + � � �� � �� + � �� 𝑖𝑖 � 𝑢0 (3.1.3) Where � � � � �� � is a second derivative of electrical current through capacitor, �� � �� is a first derivate of the electrical current through the capacitor and L is inductance. For the voltage over capacitor, the equation that was solved is a linear differential equation of the first order: �� � �� 𝑢 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.1.4) Similar to the RC circuit, a numerical method was also used. (3.1.1) A similar approach was used, as in the case of the RC circuit, but u L was also used, which by de- finition is: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 7 ---------- Figure 5: RLC circuit with a resistor R, capacitor C, inductor L and a DC supply u Some equations needed to be written for the analytical approach. First, the loop for voltages: 𝑢𝑢𝑢𝑢𝑢 � +𝑢𝑢 � +𝑢𝑢 � (3.1.1) A similar approach was used, as in the case of the RC circuit, but 𝑢𝑢 � was also used, which by definition is: 𝑢𝑢 � 𝑢𝐿𝐿 �� � �� (3.1.2) In order to consider everything and put it into an equation, a second order differential equation for the electrical current through the capacitor was solved: � � � � �� � + � � �� � �� + � �� 𝑖𝑖 � 𝑢0 (3.1.3) Where � � � � �� � is a second derivative of electrical current through capacitor, �� � �� is a first derivate of the electrical current through the capacitor and L is inductance. For the voltage over capacitor, the equation that was solved is a linear differential equation of the first order: �� � �� 𝑢 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.1.4) Similar to the RC circuit, a numerical method was also used. (3.1.2) In order to consider everything and put it into an equation, a second order differential equation for the electrical current through the capacitor was solved: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 7 ---------- Figure 5: RLC circuit with a resistor R, capacitor C, inductor L and a DC supply u Some equations needed to be written for the analytical approach. First, the loop for voltages: 𝑢𝑢𝑢𝑢𝑢 � +𝑢𝑢 � +𝑢𝑢 � (3.1.1) A similar approach was used, as in the case of the RC circuit, but 𝑢𝑢 � was also used, which by definition is: 𝑢𝑢 � 𝑢𝐿𝐿 �� � �� (3.1.2) In order to consider everything and put it into an equation, a second order differential equation for the electrical current through the capacitor was solved: � � � � �� � + � � �� � �� + � �� 𝑖𝑖 � 𝑢0 (3.1.3) Where � � � � �� � is a second derivative of electrical current through capacitor, �� � �� is a first derivate of the electrical current through the capacitor and L is inductance. For the voltage over capacitor, the equation that was solved is a linear differential equation of the first order: �� � �� 𝑢 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.1.4) Similar to the RC circuit, a numerical method was also used. (3.1.3) Where Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 7 ---------- Figure 5: RLC circuit with a resistor R, capacitor C, inductor L and a DC supply u Some equations needed to be written for the analytical approach. First, the loop for voltages: 𝑢𝑢𝑢𝑢𝑢 � +𝑢𝑢 � +𝑢𝑢 � (3.1.1) A similar approach was used, as in the case of the RC circuit, but 𝑢𝑢 � was also used, which by definition is: 𝑢𝑢 � 𝑢𝐿𝐿 �� � �� (3.1.2) In order to consider everything and put it into an equation, a second order differential equation for the electrical current through the capacitor was solved: � � � � �� � + � � �� � �� + � �� 𝑖𝑖 � 𝑢0 (3.1.3) Where � � � � �� � is a second derivative of electrical current through capacitor, �� � �� is a first derivate of the electrical current through the capacitor and L is inductance. For the voltage over capacitor, the equation that was solved is a linear differential equation of the first order: �� � �� 𝑢 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.1.4) Similar to the RC circuit, a numerical method was also used. is a second derivative of electrical current through capacitor, Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 7 ---------- Figure 5: RLC circuit with a resistor R, capacitor C, inductor L and a DC supply u Some equations needed to be written for the analytical approach. First, the loop for voltages: 𝑢𝑢𝑢𝑢𝑢 � +𝑢𝑢 � +𝑢𝑢 � (3.1.1) A similar approach was used, as in the case of the RC circuit, but 𝑢𝑢 � was also used, which by definition is: 𝑢𝑢 � 𝑢𝐿𝐿 �� � �� (3.1.2) In order to consider everything and put it into an equation, a second order differential equation for the electrical current through the capacitor was solved: � � � � �� � + � � �� � �� + � �� 𝑖𝑖 � 𝑢0 (3.1.3) Where � � � � �� � is a second derivative of electrical current through capacitor, �� � �� is a first derivate of the electrical current through the capacitor and L is inductance. For the voltage over capacitor, the equation that was solved is a linear differential equation of the first order: �� � �� 𝑢 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.1.4) Similar to the RC circuit, a numerical method was also used. is a first derivate of the electrical current through the capacitor and L is inductance. For the voltage over capacitor, the equation that was solved is a linear differential equation of the first order: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 7 ---------- Figure 5: RLC circuit with a resistor R, capacitor C, inductor L and a DC supply u Some equations needed to be written for the analytical approach. First, the loop for voltages: 𝑢𝑢𝑢𝑢𝑢 � +𝑢𝑢 � +𝑢𝑢 � (3.1.1) A similar approach was used, as in the case of the RC circuit, but 𝑢𝑢 � was also used, which by definition is: 𝑢𝑢 � 𝑢𝐿𝐿 �� � �� (3.1.2) In order to consider everything and put it into an equation, a second order differential equation for the electrical current through the capacitor was solved: � � � � �� � + � � �� � �� + � �� 𝑖𝑖 � 𝑢0 (3.1.3) Where � � � � �� � is a second derivative of electrical current through capacitor, �� � �� is a first derivate of the electrical current through the capacitor and L is inductance. For the voltage over capacitor, the equation that was solved is a linear differential equation of the first order: �� � �� 𝑢 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.1.4) Similar to the RC circuit, a numerical method was also used. (3.1.4) Similar to the RC circuit, a numerical method was also used. JET 71 Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 3.2 Numerical method 3.2.1 MATLAB and state space To begin, the RLC circuit had to be converted into a state space. 8 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- 3.2 Numerical method 3.2.1 MATLAB and state space To begin, the RLC circuit had to be converted into a state space. 𝑥𝑥 ̇ = 𝐴𝐴 𝑥𝑥 𝐴 𝐴𝐴𝐴𝐴 (3.2.1.1) 𝑦𝑦 =𝑦𝑦 � 𝑥𝑥 𝐴 𝑥𝑥𝐴𝐴 (3.2.1.2) � 𝑥𝑥̇ � 𝑥𝑥̇ � �= � − � � − � � � � 0 �∙ � 𝑥𝑥 � 𝑥𝑥 � �𝐴 � 1 𝐿𝐿 0 �∙𝐴𝐴 (3.2.1.3) y=[0 1] � ∙ � 𝑥𝑥 � 𝑥𝑥 � �𝐴0∙ 𝐴𝐴 (3.2.1.4) Matrices a, b, c and d again represent a mathematical notation called state space. Based on the matrices, graphs were plotted at values: R=10Ω, C=1000e-6F, L=1H. Figure 6: Charging and discharging of a capacitor in an RLC circuit As is clearly demonstrated above, the flow is not the same as in the RC circuit. This is because the damping is present due to the two energy sinks that are in the circuit, which are the capacitor and inductor. The higher the resistance R, the bigger the damping, therefore it was necessary to take the right value of resistance R, at R=10Ω. The response at charging is extremely fast, then damping does its job and the amplitude slowly lowers until it hits zero, then at some point it starts discharging, as is seen in the second graph. (3.2.1.1) 8 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- 3.2 Numerical method 3.2.1 MATLAB and state space To begin, the RLC circuit had to be converted into a state space. 𝑥𝑥 ̇ = 𝐴𝐴 𝑥𝑥 𝐴 𝐴𝐴𝐴𝐴 (3.2.1.1) 𝑦𝑦 =𝑦𝑦 � 𝑥𝑥 𝐴 𝑥𝑥𝐴𝐴 (3.2.1.2) � 𝑥𝑥̇ � 𝑥𝑥̇ � �= � − � � − � � � � 0 �∙ � 𝑥𝑥 � 𝑥𝑥 � �𝐴 � 1 𝐿𝐿 0 �∙𝐴𝐴 (3.2.1.3) y=[0 1] � ∙ � 𝑥𝑥 � 𝑥𝑥 � �𝐴0∙ 𝐴𝐴 (3.2.1.4) Matrices a, b, c and d again represent a mathematical notation called state space. Based on the matrices, graphs were plotted at values: R=10Ω, C=1000e-6F, L=1H. Figure 6: Charging and discharging of a capacitor in an RLC circuit As is clearly demonstrated above, the flow is not the same as in the RC circuit. This is because the damping is present due to the two energy sinks that are in the circuit, which are the capacitor and inductor. The higher the resistance R, the bigger the damping, therefore it was necessary to take the right value of resistance R, at R=10Ω. The response at charging is extremely fast, then damping does its job and the amplitude slowly lowers until it hits zero, then at some point it starts discharging, as is seen in the second graph. (3.2.1.2) 8 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- 3.2 Numerical method 3.2.1 MATLAB and state space To begin, the RLC circuit had to be converted into a state space. 𝑥𝑥 ̇ = 𝐴𝐴 𝑥𝑥 𝐴 𝐴𝐴𝐴𝐴 (3.2.1.1) 𝑦𝑦 =𝑦𝑦 � 𝑥𝑥 𝐴 𝑥𝑥𝐴𝐴 (3.2.1.2) � 𝑥𝑥̇ � 𝑥𝑥̇ � �= � − � � − � � � � 0 �∙ � 𝑥𝑥 � 𝑥𝑥 � �𝐴 � 1 𝐿𝐿 0 �∙𝐴𝐴 (3.2.1.3) y=[0 1] � ∙ � 𝑥𝑥 � 𝑥𝑥 � �𝐴0∙ 𝐴𝐴 (3.2.1.4) Matrices a, b, c and d again represent a mathematical notation called state space. Based on the matrices, graphs were plotted at values: R=10Ω, C=1000e-6F, L=1H. Figure 6: Charging and discharging of a capacitor in an RLC circuit As is clearly demonstrated above, the flow is not the same as in the RC circuit. This is because the damping is present due to the two energy sinks that are in the circuit, which are the capacitor and inductor. The higher the resistance R, the bigger the damping, therefore it was necessary to take the right value of resistance R, at R=10Ω. The response at charging is extremely fast, then damping does its job and the amplitude slowly lowers until it hits zero, then at some point it starts discharging, as is seen in the second graph. (3.2.1.3) 8 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- 3.2 Numerical method 3.2.1 MATLAB and state space To begin, the RLC circuit had to be converted into a state space. 𝑥𝑥 ̇ = 𝐴𝐴 𝑥𝑥 𝐴 𝐴𝐴𝐴𝐴 (3.2.1.1) 𝑦𝑦 =𝑦𝑦 � 𝑥𝑥 𝐴 𝑥𝑥𝐴𝐴 (3.2.1.2) � 𝑥𝑥̇ � 𝑥𝑥̇ � �= � − � � − � � � � 0 �∙ � 𝑥𝑥 � 𝑥𝑥 � �𝐴 � 1 𝐿𝐿 0 �∙𝐴𝐴 (3.2.1.3) y=[0 1] � ∙ � 𝑥𝑥 � 𝑥𝑥 � �𝐴0∙ 𝐴𝐴 (3.2.1.4) Matrices a, b, c and d again represent a mathematical notation called state space. Based on the matrices, graphs were plotted at values: R=10Ω, C=1000e-6F, L=1H. Figure 6: Charging and discharging of a capacitor in an RLC circuit As is clearly demonstrated above, the flow is not the same as in the RC circuit. This is because the damping is present due to the two energy sinks that are in the circuit, which are the capacitor and inductor. The higher the resistance R, the bigger the damping, therefore it was necessary to take the right value of resistance R, at R=10Ω. The response at charging is extremely fast, then damping does its job and the amplitude slowly lowers until it hits zero, then at some point it starts discharging, as is seen in the second graph. (3.2.1.4) Matrices a, b, c and d again represent a mathematical notation called state space. Based on the matrices, graphs were plotted at values: R=10Ω, C=1000e-6F, L=1H. Figure 6: Charging and discharging of a capacitor in an RLC circuit As is clearly demonstrated above, the flow is not the same as in the RC circuit. This is because the damping is present due to the two energy sinks that are in the circuit, which are the capacitor and inductor. The higher the resistance R, the bigger the damping, therefore it was necessary to take the right value of resistance R, at R=10Ω. The response at charging is extremely fast, then damping does its job and the amplitude slowly lowers until it hits zero, then at some point it starts discharging, as is seen in the second graph. 72 JET 72 JET Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 3.2.2 MATLAB and Simulink A numerical method was also used in MATLAB and Simulink. First, an equation for voltage over capacitor needed to be calculated, even more so than the one from chapter 3.1, equation (3.1.4). Since in the circuit all three elements are in series, i.e. connected one after another, the electrical current is the same through all three elements, hence it can be said that: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 9 ---------- 3.2.2 MATLAB and Simulink A numerical method was also used in MATLAB and Simulink. First, an equation for voltage over capacitor needed to be calculated, even more so than the one from chapter 3.1, equation (3.1.4). Since in the circuit all three elements are in series, i.e. connected one after another, the electrical current is the same through all three elements, hence it can be said that: 𝑖𝑖𝑖𝑖𝑖 � 𝑖𝑖𝑖 � 𝑖𝑖𝑖 � (3.2.2.1) Because all three currents are the same, instead of 𝑖𝑖 � , which is the same as 𝑖𝑖 � , it can be written as: 𝑖𝑖 � 𝑖𝐶𝐶 �� � �� (3.2.2.2) In equation (3.1.4), instead of iL, the equation (3.2.2.2) is written, thus: �� � �� 𝑖 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.3) After some work and solving the equation, again a derivative of 𝑢𝑢 � is needed, and since it already is in the equation, when 𝑖𝑖 � is written as 𝐶𝐶 �� � �� , this is what is solved: � � � � �� � 𝑖 � �� 𝑢𝑢𝑢 � � �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.4) Where � � � � �� � is a second derivative of voltage over capacitor over time, �� � �� is a first derivate of voltage over capacitor over time. The equation represents a second order differential equation for voltage over capacitor. Based on this equation, again a Simulink block diagram was constructed to represent the voltage over capacitor, so that the graphs could be plotted. Figure 7: Simulink block diagram Again, the code had to be written in MATLAB and connected to Simulink through the MATLAB ‘sim’ function, so that the code could work perfectly, based on the Simulink block diagram. The value of R was 10Ω, of C was 1000e-6F and L was 1H. The graphs that were plotted are: supply (3.2.2.1) Because all three currents are the same, instead of i L , which is the same as i C , it can be written as: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 9 ---------- 3.2.2 MATLAB and Simulink A numerical method was also used in MATLAB and Simulink. First, an equation for voltage over capacitor needed to be calculated, even more so than the one from chapter 3.1, equation (3.1.4). Since in the circuit all three elements are in series, i.e. connected one after another, the electrical current is the same through all three elements, hence it can be said that: 𝑖𝑖𝑖𝑖𝑖 � 𝑖𝑖𝑖 � 𝑖𝑖𝑖 � (3.2.2.1) Because all three currents are the same, instead of 𝑖𝑖 � , which is the same as 𝑖𝑖 � , it can be written as: 𝑖𝑖 � 𝑖𝐶𝐶 �� � �� (3.2.2.2) In equation (3.1.4), instead of iL, the equation (3.2.2.2) is written, thus: �� � �� 𝑖 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.3) After some work and solving the equation, again a derivative of 𝑢𝑢 � is needed, and since it already is in the equation, when 𝑖𝑖 � is written as 𝐶𝐶 �� � �� , this is what is solved: � � � � �� � 𝑖 � �� 𝑢𝑢𝑢 � � �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.4) Where � � � � �� � is a second derivative of voltage over capacitor over time, �� � �� is a first derivate of voltage over capacitor over time. The equation represents a second order differential equation for voltage over capacitor. Based on this equation, again a Simulink block diagram was constructed to represent the voltage over capacitor, so that the graphs could be plotted. Figure 7: Simulink block diagram Again, the code had to be written in MATLAB and connected to Simulink through the MATLAB ‘sim’ function, so that the code could work perfectly, based on the Simulink block diagram. The value of R was 10Ω, of C was 1000e-6F and L was 1H. The graphs that were plotted are: supply (3.2.2.2) In equation (3.1.4), instead of iL, the equation (3.2.2.2) is written, thus: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 9 ---------- 3.2.2 MATLAB and Simulink A numerical method was also used in MATLAB and Simulink. First, an equation for voltage over capacitor needed to be calculated, even more so than the one from chapter 3.1, equation (3.1.4). Since in the circuit all three elements are in series, i.e. connected one after another, the electrical current is the same through all three elements, hence it can be said that: 𝑖𝑖𝑖𝑖𝑖 � 𝑖𝑖𝑖 � 𝑖𝑖𝑖 � (3.2.2.1) Because all three currents are the same, instead of 𝑖𝑖 � , which is the same as 𝑖𝑖 � , it can be written as: 𝑖𝑖 � 𝑖𝐶𝐶 �� � �� (3.2.2.2) In equation (3.1.4), instead of iL, the equation (3.2.2.2) is written, thus: �� � �� 𝑖 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.3) After some work and solving the equation, again a derivative of 𝑢𝑢 � is needed, and since it already is in the equation, when 𝑖𝑖 � is written as 𝐶𝐶 �� � �� , this is what is solved: � � � � �� � 𝑖 � �� 𝑢𝑢𝑢 � � �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.4) Where � � � � �� � is a second derivative of voltage over capacitor over time, �� � �� is a first derivate of voltage over capacitor over time. The equation represents a second order differential equation for voltage over capacitor. Based on this equation, again a Simulink block diagram was constructed to represent the voltage over capacitor, so that the graphs could be plotted. Figure 7: Simulink block diagram Again, the code had to be written in MATLAB and connected to Simulink through the MATLAB ‘sim’ function, so that the code could work perfectly, based on the Simulink block diagram. The value of R was 10Ω, of C was 1000e-6F and L was 1H. The graphs that were plotted are: supply (3.2.2.3) After some work and solving the equation, again a derivative of u C is needed, and since it already is in the equation, when i L is written as Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 9 ---------- 3.2.2 MATLAB and Simulink A numerical method was also used in MATLAB and Simulink. First, an equation for voltage over capacitor needed to be calculated, even more so than the one from chapter 3.1, equation (3.1.4). Since in the circuit all three elements are in series, i.e. connected one after another, the electrical current is the same through all three elements, hence it can be said that: 𝑖𝑖𝑖𝑖𝑖 � 𝑖𝑖𝑖 � 𝑖𝑖𝑖 � (3.2.2.1) Because all three currents are the same, instead of 𝑖𝑖 � , which is the same as 𝑖𝑖 � , it can be written as: 𝑖𝑖 � 𝑖𝐶𝐶 �� � �� (3.2.2.2) In equation (3.1.4), instead of iL, the equation (3.2.2.2) is written, thus: �� � �� 𝑖 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.3) After some work and solving the equation, again a derivative of 𝑢𝑢 � is needed, and since it already is in the equation, when 𝑖𝑖 � is written as 𝐶𝐶 �� � �� , this is what is solved: � � � � �� � 𝑖 � �� 𝑢𝑢𝑢 � � �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.4) Where � � � � �� � is a second derivative of voltage over capacitor over time, �� � �� is a first derivate of voltage over capacitor over time. The equation represents a second order differential equation for voltage over capacitor. Based on this equation, again a Simulink block diagram was constructed to represent the voltage over capacitor, so that the graphs could be plotted. Figure 7: Simulink block diagram Again, the code had to be written in MATLAB and connected to Simulink through the MATLAB ‘sim’ function, so that the code could work perfectly, based on the Simulink block diagram. The value of R was 10Ω, of C was 1000e-6F and L was 1H. The graphs that were plotted are: supply , this is what is solved: Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 9 ---------- 3.2.2 MATLAB and Simulink A numerical method was also used in MATLAB and Simulink. First, an equation for voltage over capacitor needed to be calculated, even more so than the one from chapter 3.1, equation (3.1.4). Since in the circuit all three elements are in series, i.e. connected one after another, the electrical current is the same through all three elements, hence it can be said that: 𝑖𝑖𝑖𝑖𝑖 � 𝑖𝑖𝑖 � 𝑖𝑖𝑖 � (3.2.2.1) Because all three currents are the same, instead of 𝑖𝑖 � , which is the same as 𝑖𝑖 � , it can be written as: 𝑖𝑖 � 𝑖𝐶𝐶 �� � �� (3.2.2.2) In equation (3.1.4), instead of iL, the equation (3.2.2.2) is written, thus: �� � �� 𝑖 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.3) After some work and solving the equation, again a derivative of 𝑢𝑢 � is needed, and since it already is in the equation, when 𝑖𝑖 � is written as 𝐶𝐶 �� � �� , this is what is solved: � � � � �� � 𝑖 � �� 𝑢𝑢𝑢 � � �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.4) Where � � � � �� � is a second derivative of voltage over capacitor over time, �� � �� is a first derivate of voltage over capacitor over time. The equation represents a second order differential equation for voltage over capacitor. Based on this equation, again a Simulink block diagram was constructed to represent the voltage over capacitor, so that the graphs could be plotted. Figure 7: Simulink block diagram Again, the code had to be written in MATLAB and connected to Simulink through the MATLAB ‘sim’ function, so that the code could work perfectly, based on the Simulink block diagram. The value of R was 10Ω, of C was 1000e-6F and L was 1H. The graphs that were plotted are: supply (3.2.2.4) Where Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 9 ---------- 3.2.2 MATLAB and Simulink A numerical method was also used in MATLAB and Simulink. First, an equation for voltage over capacitor needed to be calculated, even more so than the one from chapter 3.1, equation (3.1.4). Since in the circuit all three elements are in series, i.e. connected one after another, the electrical current is the same through all three elements, hence it can be said that: 𝑖𝑖𝑖𝑖𝑖 � 𝑖𝑖𝑖 � 𝑖𝑖𝑖 � (3.2.2.1) Because all three currents are the same, instead of 𝑖𝑖 � , which is the same as 𝑖𝑖 � , it can be written as: 𝑖𝑖 � 𝑖𝐶𝐶 �� � �� (3.2.2.2) In equation (3.1.4), instead of iL, the equation (3.2.2.2) is written, thus: �� � �� 𝑖 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.3) After some work and solving the equation, again a derivative of 𝑢𝑢 � is needed, and since it already is in the equation, when 𝑖𝑖 � is written as 𝐶𝐶 �� � �� , this is what is solved: � � � � �� � 𝑖 � �� 𝑢𝑢𝑢 � � �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.4) Where � � � � �� � is a second derivative of voltage over capacitor over time, �� � �� is a first derivate of voltage over capacitor over time. The equation represents a second order differential equation for voltage over capacitor. Based on this equation, again a Simulink block diagram was constructed to represent the voltage over capacitor, so that the graphs could be plotted. Figure 7: Simulink block diagram Again, the code had to be written in MATLAB and connected to Simulink through the MATLAB ‘sim’ function, so that the code could work perfectly, based on the Simulink block diagram. The value of R was 10Ω, of C was 1000e-6F and L was 1H. The graphs that were plotted are: supply is a second derivative of voltage over capacitor over time, Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 9 ---------- 3.2.2 MATLAB and Simulink A numerical method was also used in MATLAB and Simulink. First, an equation for voltage over capacitor needed to be calculated, even more so than the one from chapter 3.1, equation (3.1.4). Since in the circuit all three elements are in series, i.e. connected one after another, the electrical current is the same through all three elements, hence it can be said that: 𝑖𝑖𝑖𝑖𝑖 � 𝑖𝑖𝑖 � 𝑖𝑖𝑖 � (3.2.2.1) Because all three currents are the same, instead of 𝑖𝑖 � , which is the same as 𝑖𝑖 � , it can be written as: 𝑖𝑖 � 𝑖𝐶𝐶 �� � �� (3.2.2.2) In equation (3.1.4), instead of iL, the equation (3.2.2.2) is written, thus: �� � �� 𝑖 � �� 𝑢𝑢𝑢 � �� �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.3) After some work and solving the equation, again a derivative of 𝑢𝑢 � is needed, and since it already is in the equation, when 𝑖𝑖 � is written as 𝐶𝐶 �� � �� , this is what is solved: � � � � �� � 𝑖 � �� 𝑢𝑢𝑢 � � �� � �� 𝑢 � �� 𝑢𝑢 � (3.2.2.4) Where � � � � �� � is a second derivative of voltage over capacitor over time, �� � �� is a first derivate of voltage over capacitor over time. The equation represents a second order differential equation for voltage over capacitor. Based on this equation, again a Simulink block diagram was constructed to represent the voltage over capacitor, so that the graphs could be plotted. Figure 7: Simulink block diagram Again, the code had to be written in MATLAB and connected to Simulink through the MATLAB ‘sim’ function, so that the code could work perfectly, based on the Simulink block diagram. The value of R was 10Ω, of C was 1000e-6F and L was 1H. The graphs that were plotted are: supply is a first derivate of voltage over capacitor over time. The equation represents a second order differential equation for voltage over capacitor. Based on this equation, again a Simulink block diagram was constructed to represent the voltage over capacitor, so that the graphs could be plotted. Figure 7: Simulink block diagram Again, the code had to be written in MATLAB and connected to Simulink through the MATLAB ‘sim’ function, so that the code could work perfectly, based on the Simulink block diagram. The value of R was 10Ω, of C was 1000e-6F and L was 1H. The graphs that were plotted are: supply voltage, voltage over capacitor, voltage over resistor, voltage over inductor and electrical current through a capacitor. JET 73 Analysis of the influence of parameters when charging and discharging a capacitor using differential equations Figure 8: Voltages and current in the RLC circuit As can be clearly seen above, damping of the system occurred. When the voltage over capacitor reaches a constant value, it means that the capacitor is fully charged, then at some point it starts discharging and falls to zero. It is interesting to note that the voltage over capacitor and inductor are reversed. 4 CHANGING THE PARAMETERS The main purpose of this article was to see how parameters, when being varied, influence the charging and discharging of a capacitor. Therefore, different variations of parameters in an RC and RLC circuit were made. After every subchapter, a few main observations were written. More detailed observations were made in the conclusion, so that the variations of the parameters could be compared. 4.1 RC circuit 4.1.1 Constant R, variation of C Initially, R was constant, and C was varied. Figure 9: Capacitor charging when C was varied 74 JET 74 JET Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 Figure 10: Capacitor discharging when C was varied Values of parameters: R C1;C2;C3 1000Ω 1000e-6F 1000Ω 1000e-5F 1000Ω 1000e-4F It is seen above that the lower the C, the more the capacitor was charged (step response). When the capacitance C was 1000e-4H, the capacitor was barely charged. 4.1.2 Constant C, variation of R Here, capacitance C was constant, while the resistance R was being varied. 12 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- 4.1.2 Constant C, variation of R Here, capacitance C was constant, while the resistance R was being varied. Figure 11: Capacitor charging when R was varied Figure 12: Capacitor discharging when R was varied Values of parameters: R1;R2;R3 C 100Ω 1000e-6F 1000Ω 1000e-6F 10000Ω 1000e-6F It is noticeable that, as in the previous example when R was constant, when R=100Ω, i.e. at the lowest value, the capacitor is most highly charged. - uC1 - uC2 - uC3 - uC1 - uC2 - uC3 Figure 11: Capacitor charging when R was varied 12 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- 4.1.2 Constant C, variation of R Here, capacitance C was constant, while the resistance R was being varied. Figure 11: Capacitor charging when R was varied Figure 12: Capacitor discharging when R was varied Values of parameters: R1;R2;R3 C 100Ω 1000e-6F 1000Ω 1000e-6F 10000Ω 1000e-6F It is noticeable that, as in the previous example when R was constant, when R=100Ω, i.e. at the lowest value, the capacitor is most highly charged. - uC1 - uC2 - uC3 - uC1 - uC2 - uC3 Figure 12: Capacitor discharging when R was varied Values of parameters: R1;R2;R3 C 100Ω 1000e-6F 1000Ω 1000e-6F 10000Ω 1000e-6F It is noticeable that, as in the previous example when R was constant, when R=100Ω, i.e. at the lowest value, the capacitor is most highly charged. JET 75 Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 4.2 RLC circuit 4.2.1 Constant C and R, variation of L Here, capacitance C and resistance R were constant, while induction L was varied. Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 13 ---------- 4.2 RLC circuit 4.2.1 Constant C and R, variation of L Here, capacitance C and resistance R were constant, while induction L was varied. Figure 13: Capacitor charging when L was varied Figure 14: Capacitor discharging when L was varied Values of parameters: R C L1;L2;L3 10Ω 1000e-6F 1H 10Ω 1000e-6F 5H 10Ω 1000e-6F 10H It seems that the higher the inductance, the more the capacitor charges, and at the lowest inductance it charges with the highest – albeit the least – overshoot. - uC1 - uC2 - uC3 - uC1 - uC2 - uC3 Figure 13: Capacitor charging when L was varied Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 13 ---------- 4.2 RLC circuit 4.2.1 Constant C and R, variation of L Here, capacitance C and resistance R were constant, while induction L was varied. Figure 13: Capacitor charging when L was varied Figure 14: Capacitor discharging when L was varied Values of parameters: R C L1;L2;L3 10Ω 1000e-6F 1H 10Ω 1000e-6F 5H 10Ω 1000e-6F 10H It seems that the higher the inductance, the more the capacitor charges, and at the lowest inductance it charges with the highest – albeit the least – overshoot. - uC1 - uC2 - uC3 - uC1 - uC2 - uC3 Figure 14: Capacitor discharging when L was varied Values of parameters: R C L1;L2;L3 10Ω 1000e-6F 1H 10Ω 1000e-6F 5H 10Ω 1000e-6F 10H It seems that the higher the inductance, the more the capacitor charges, and at the lowest indu- ctance it charges with the highest – albeit the least – overshoot. 4.2.2 Constant L and R, variation of C Here, inductance L and resistance R were constant, and capacitance C was varied. 76 JET 76 JET Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 14 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- 4.2.2 Constant L and R, variation of C Here, inductance L and resistance R were constant, and capacitance C was varied. Figure 15: Capacitor charging when C was varied Figure 16: Capacitor discharging when L was varied Values: R C1;C2;C3 L 10Ω 1000e-6F 1H 10Ω 1000e-5F 1H 10Ω 1000e-4F 1H The graph again shows that at the smallest capacitance, the capacitor filled up the most, whereas at the largest C, the charge behaved like a first order system, due to the damping being equal to 1, which is called critical damping. - uC1 - uC2 - uC3 - uC1 - uC2 - uC3 Figure 15: Capacitor charging when C was varied 14 Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 ---------- 4.2.2 Constant L and R, variation of C Here, inductance L and resistance R were constant, and capacitance C was varied. Figure 15: Capacitor charging when C was varied Figure 16: Capacitor discharging when L was varied Values: R C1;C2;C3 L 10Ω 1000e-6F 1H 10Ω 1000e-5F 1H 10Ω 1000e-4F 1H The graph again shows that at the smallest capacitance, the capacitor filled up the most, whereas at the largest C, the charge behaved like a first order system, due to the damping being equal to 1, which is called critical damping. - uC1 - uC2 - uC3 - uC1 - uC2 - uC3 Figure 16: Capacitor discharging when L was varied Values: R C1;C2;C3 L 10Ω 1000e-6F 1H 10Ω 1000e-5F 1H 10Ω 1000e-4F 1H The graph again shows that at the smallest capacitance, the capacitor filled up the most, whereas at the largest C, the charge behaved like a first order system, due to the damping being equal to 1, which is called critical damping. 4.2.3 Constant C and L, variation of R Finally, capacitance C and inductance L were constant, while resistance R was varied. Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 15 ---------- 4.2.3 Constant C and L, variation of R Finally, capacitance C and inductance L were constant, while resistance R was varied. Figure 17: Capacitor charging when R was varied Figure 18: Capacitor discharging when L was varied Values: R1;R2;R3 C L 100Ω 1000e-6F 1H 1000Ω 1000e-6F 1H 10000Ω 1000e-6F 1H These graphs illustrate the worst response of the system. The fastest response was at R=100Ω, while at R=10000Ω the response was almost linear. - uC1 - uC2 - uC3 - uC1 - uC2 - uC3 Figure 17: Capacitor charging when R was varied JET 77 Analysis of the influence of parameters when charging and discharging a capacitor using differential equations Analysis of the influence of parameters when charging and discharging a capacitor using differential equations 15 ---------- 4.2.3 Constant C and L, variation of R Finally, capacitance C and inductance L were constant, while resistance R was varied. Figure 17: Capacitor charging when R was varied Figure 18: Capacitor discharging when L was varied Values: R1;R2;R3 C L 100Ω 1000e-6F 1H 1000Ω 1000e-6F 1H 10000Ω 1000e-6F 1H These graphs illustrate the worst response of the system. The fastest response was at R=100Ω, while at R=10000Ω the response was almost linear. - uC1 - uC2 - uC3 - uC1 - uC2 - uC3 Figure 18: Capacitor discharging when L was varied Values: R1;R2;R3 C L 100Ω 1000e-6F 1H 1000Ω 1000e-6F 1H 10000Ω 1000e-6F 1H These graphs illustrate the worst response of the system. The fastest response was at R=100Ω, while at R=10000Ω the response was almost linear. 5 CONCLUSION With the aim of finding at which parameters the capacitor charges the most (which was also the main point of the article), different values of parameter and variations were taken and made in RC and RLC circuits, which were clearly illustrated in the graphs. For the RC circuit, it can be seen that when varying resistance R and capacitance C, the response barely changed, and both were almost the same. Therefore, at constant R, it is better to take the lower C, so that capacitor is most highly charged. At constant R, it is also better to take the lower, so that capacitor can be charged more rapidly. Different things happened in the RLC circuit. First, when the variation of inductance L was made, three concise waves were plotted, which indicated that at the highest inductance, the capacitor charged with the highest overshoot with the highest settling time, while at the lowest inductance, the capacitor charged with the lowest overshoot, which was the shortest settling time. Next, the variation of capacitance C was opposite to that of inductance. At the lowest capaci- tance, the capacitor charged with the highest overshoot and also had the fastest response. At the highest capacitance C, the response did not even exceed 1V and it behaved like a first order system (if only one capacitor/inductor was in the system, but the circuit had two), due to the damping being equal to 1, which is called critical damping. Finally, when the variation of resistance R was made, something different happened. A similar response occurred at R=100Ω and R=1000Ω. When R was 100Ω it was the fastest response, while at uC=1V it was fully charged. At R=1000Ω the capacitor was also fully charged at uC=1V, however the response was slightly slower and it took more time for the capacitor to charge to maximum. At the highest resistance R, i.e. 10000Ω, the response was the slowest and did not reach the vol- 78 JET 78 JET Matic Krašovic, Peter Virtič JET Vol. 15 (2022) Issue 2 tage, as the previous two did, and was almost linear. Therefore, it can be concluded that taking the lowest resistance is the best option, so the capacitor is charged the fastest. The results of the findings and research at the RLC-circuit were seen when varying the inductance L and keeping R and C constant. The differences between RC and RLC-circuit are described and can be easily seen. References [1] Atsushi Sakurai, Bo Zhao, Zhuomin M. Zhang: Resonant frequency and bandwidth of metamaterial emitters and absorbers predicted by an RLC model, Journal of Quantita- tive Spectroscopy & Radiative Transfer 149 (2014) [2] Timo Reis, Fedor Glazov: System theoretic properties of linear RLC circuits, IFAC Paper- sOnLine (2021) [3] Shichao Zheng, Zhongjian Kang, Lei Li, Anqi Zhang, Kai Zhao, Yaxun Zhou: Influence of series RC circuit parameters on the streamer discharge process of gas park switch, Elsevier, Vacuum 193 (2021), 110518 [4] Mohammad Al-Khaleel, Martin J. Gander, Albert E. Ruehli: A mathematical analysis of optimized waveform relaxation for a small RC circuit, Elsevier, Applied Numerical Mathematics 75 (2014) [5] Roman Ya. Kezerashvili: Teaching RC and RL Circuits Using Computer-supported Exper- iments, Elsevier, IERI Procedia 2 (2012) Nomenclature (Symbols) (Symbol meaning) t time i current i L current through inductor i R current through resistor i C current through capacitor u supply voltage u C voltage over capacitor u R voltage over resistor u L voltage over inductor C capacitance L inductance R resistance e Euler constant du C /dt First derivate of voltage over capacitor over time JET 79 Analysis of the influence of parameters when charging and discharging a capacitor using differential equations di L /dt First derivate of current through inductor over time d 2 u C /dt 2 Second derivate of voltage over capacitor over time d 2 i C /dt 2 First derivate of current through capacitor over time