ThammasatInt. J. Sc. Tech.,Vol. 13. No. 2, April-June2008 Modelingof an RC Circuit [Jsinga StochasticDifferential Equation Tarun Kumar Rawat and Harish Parthasarathy Division of Electronicsand CommunicationEngineering Netaji SubhasInstituteof Technology Sector-3,Dwarka,New Delhi-l10075,India. com E-mail: tarundso(dsmai1. Abstract circuit: external noise and internal noise. The in an electrical noises can exist Two types of effectsof both types of noisesin electricalcircuits are ignoredwhen using a deterministicdifferential equationfor their modeling.The deterministicmodel of the circuit is replacedby a stochasticmodel by adding a noise term in both the potential source(externalnoise) and the resistance(internal noise). Stochasticmodels are more appropriateto describefor instancethe outcomeof repeatedexperiments. The noise addedin the potentialsourceis assumedto be a white noise and that addedin the resistance is assumtd to be a correlatedprocess.A first-order ordinary differential equation and its stochastic analoguesis used for the DC responseanalysisof an RC circuit. The first-orderdifferential equation, which describesthe concentrationof charge in an the capacitor, is solved explicitly in both the deterministicand stochasticcase.This method gives an explicit relation expressingthe sensitivityof the performancewith respectto input parametersand their tolerancesso it can be used for design optimization.Numerical simulationsin MATLAB are obtainedusing the Euler-Maruyamamethod. Keywords: RC electrical circuit, ordinary differential equation, stochasticdifferential equation, Brownian motion process,Euler-Maruyamamethod. the input and intemal parameters in the deterministic model by random processes. Random differential equationsof this type can be interpreted as ,stochastic differential equations, following Ito's basic work in the early 1940s [a][5]. Solutionsof such equations represent Markov diffusion processes, the prototype of which is the Brownian motion processalternativelycalled the Wiener process 1. Introduction Two types of noises can exist in an electrical circuit: external noise and internal noise. Extemal noise denotesfluctuationsin an otherwisedeterministicsystemto which external forces are applied. An example that has wide applicationsin engineeringconsistsof adding a noise term to the right side of a deterministic equation. Langevin formulated the first such model in 1908 to describe the velocity of a particle moving in a random force field. A well known exampleof internalnoise in an electrical circuit is thermal noise, caused by the discretenessof electric charges [][2]. Many other types of internalnoise in electricalcircuits are: shot noise,low frequencynoise,burst noise etc. [3]. Obviously, at a finite temperature,there is no dissipative electrical circuit without thermalnoise. The effects of both types of noises in electrical circuits are ignored when using a deterministic differential equation for their modeling. Random effects due to both external and internal noise can be included by replacing t6l-tel The literaturemainly distinguishesbetween sampling and non-sampling methods for the purposeof stochasticanalysis.Samplingis done with the Monte Carlo method tl0l tlll Stochastic information on circuits without sampling is obtained with Hermite-Polynomia chaos ll2l. Our method falls in the later category. In this paper, the ordinary differentiaequation and its stochastic analogous, which describes the concentration of charge in the capacitorof a RC circuit, is solvedexplicitly for both the deterministicand stochasticcases.This method is based on results from the theory of stochasticdifferential equations(SDE) [5]. The 40 ThammasatInt. J. Sc. Tech.,Vol. 13, No. 2, April-June2008 method is general.in the following sense.Any electrical circuit which consists of resistor, inductor and capacitor can be modeled by an ordinary differential equation in which the parameters of the differential operators are functions of circuit elements.The deterministic ordinary differential equation can be converted into a stochasticdifferential equationby adding noise to the input potential source and to the circuit elements. The noise added in the potential sourceis assumedto be a white noise and that added in the parametersis assumedto be a correlatedprocessbecausetheseparameters changevery slowly with time and hencemust be modeled as a correlatedprocess(Appendix A). The resulting SDE is solved by using a nonMonte Carlo method.MATLAB simulationsare usedto verify analyticalresults. In the next section,the stochasticcalculus theory is reviewed.Sections3 and4 describethe modeling of an RC circuit using an ordinary differential equation (ODE) and an SDE, respectively,and their analyticalsolution is also presented.In Section 5, the Euler-Maruyama schemeis reviewedfor the numericalsolutionof SDE. Finally, the analytical results obtained in Sections 3 & 4 are verified with MATLAB simulations in Section 6 followed by the c o n c l u s i o ni sn S e c t i o n7 . Stochastic integrals and differential equationswere introduced by Ito [4] and are being widely used and, hence,are called the Ito integral. Stratonovich [3] proposed another representation for stochastic integrals and differential equations under rather restrictive conditions,which has a numberof advantagesin this computational techniques. Using representation,we can work with stochastic integrals in the same way as with the ordinary integrals of smooth functions, such as integrationby parts and changing of variables. The Ito integral, however, has a mathematical expectation which can be written more concisely. Simple formulas for the transition from one integral to the other allow at all times for the selectionof the representationwhich is most convenientfor any particular purpose.In this section, we only explicitly summarizethe difference and the conversionbetween Ito and rigorously Stratonovich integrals. More mathematicaltreatmentsof this issue are given in Ual-[6]. A. Stochasticlntegrals L e t / u < t , 3 " ' l t n = 7 b e a p a r t i t i o no f . r -l /. \ t h e i n t e r v a lf 0 . / I a n d d , = l r l ? X ( l ,- I , t I . The l: Definition Ito integral T Stochastic Differential Equation and Stochastic Calculus Considera SDE; 2. JC1r, is definedas the limit in the quadraticmean (qm) T dX(t1= t(x(t),t)dt+ G(x(r),/)dB(/) (l) X1';1an1'; Y,(t)= JC1r, where f is an r - vector valued function, G is an nxm matrix valued function, B(/) is an rn - dimensional Brownian motion process or Wiener process, and the solution X(/) is an Io def n qm-lim = d n - - )o ) c 1 x , , , t , r ) ( 8 , -, 8 , ,, ) (3) i=l If the integrandG is jointly measurableand n-vector process.By a solution X(l) of the stochasticdifferential equation (1), is meant a processX(l) , for all t , in some intervaf [t' f ] T l' )ds< oo Jr1lc1r,x1s)) (4) I0 must satisfythe integralequation: then the limit in (3) existst14l[15].If G insteadof (4),theweakercondition satisfies, T. x(/) : X(to) + Jf(s,X(s))ds ,,, x1r;;an(s) T (21 Jlctt,x{t)) T + JG1s, x(s))dB(s) l t , l t < c t t , a l m o s st u r e l v - ( 5 ) the stochasticintegral in (3) is defined as the hmit in probabili4t. DeJinition 2; The Stratonovich integral is definedby : where X(rn ) is a specifiedinitial value,the first integral in (2) is an ordinary integral, and the secondintegralin (2) is the stochasticintegral. 4l Thammasat "'- -: x . ( r ) = x , ( r o )J+, t r r x( r ) . r ) + ] t ' t 1 . 2_t=,_^_, r, (r)= Jc1", x1";;ar1"; t0 ( G , ,( X , ( r ) . r ) ) r G * , ( X , (r ) . r l ) d r der qm-rim -\ ( X, = E nr O ) G l - t f i = l + X, \ ) 4 ' t , - ' l ( 8 ,-B', ,) , (l l) +(1)fc(x ,(r),r)dB, ) (6) the to the conditions on In addition existenceofthe Ito integral,it is requiredfor the existenceofthe Stratonovichintegral in (6) that the G(X(t),t) function be continuousin / and have continuous partial derivatives with respect where the last integralsof right side of (10) and (11) are Stratonovich and Ito integrals, the respectively. From (10) and (1 l) Staratonovichdifferential equation: ( \ to X, [3]-[6]. Under the existence of (6), Stratonovich [13] provided the connectionbetweenthesetwo stochasticintegralsby : , *l [IT(c- ^ n z/=lr=l ) \r tr G" ,r ,I l d r + G d B . ) /r2) correspondsto the Ito differential equation (13) dX, =fdt +GdB, Y,0) : Y,(/) lT-, 1 d x, . =| rl - -, Il uFu . r c where )',li=,{c*)rc*, correction term. (\ 7 ' I) r X . s ) )c , , ( X " , s v s is the so-called -) J - ? ^ ?K\ = t t l=t wherethe n-vector (G,^ ), is the /th column \ae ,f axr). To clearly illustrate these integration concepts, the simple examplein [13] using a one-dimensional of nxm matrix G,, FT considered. l,.w(s)dw,,is Example1. By using (3), we have [9]: stochasticintegral T | , . ) ) , l^ y t Q ) : l w ( s l d w=, ( w i - w i , ) f2 - ( T - t o ) r 2 ,o (8) By using(6), we have[9]: T r ' / , ( 1 )= l w ( s ) d w , = that dB, is always independentof 8,, and,dBi ( w ,? - r r, ., ,2, \, l -) {gt tt is approximatelydt . In contrast to the above Ito description, in (l) the white noise driving term is consideredas an approximation of a very wide band but smooth colored process. The differential equationcan be solved exactly for each sample function of the smooth processusing classical calculus. As driving noise approacheswhite, the solved processdoes convergeto the solution in the Stratonovich sense. Thus, the rule of ordinary calculus can be applied to a Stratonovichequation.However, if the noise in SDE is not statemultiplicative,i.e., G in (l) is independent of states, and only a nonrandom function of time t , the correction term disappears,which can be seen from (10)-(13). That is, Ito interpretation and Stratonovich intemretationcoincides. r0 which aan be also obtained by a direct integration by partsjust as for ordinary integrals. Since stochasticintegralscan be computed in two distinct ways, there are two different solutions,Ito and Stratonovichsolutionsto (2), and hence to (l). However these two different solutions can be converted into each other by using simple formulas [13] of : I rr. x , ( r )= X , ( / n )J|+ [ r 1 x , ( r )-,+r2 z)t- /-i = l / - /tI -"- l ,'- . (G,(,X ,( r ) , ) ) , Gr,(X ,(r),)p r d + ( S )I G ( X /(r \ , r l d B , B. Interpretation The paradox of obtaining two different stochasticprocessesas solutions to the same stochastic differential equation arises from the pathological nature of white noise. Since all sample functions of a Wiener process are nowhere differentiable and of unbounded variation,and hence,are not smooth,we can not interpret the Ito integral as an ordinary Riemann-Stieltjes integral. Therefore, Ito calculus does not conform to the rules of ordinary calculus,which can be easily seen in example 1. The correction term is due to the fact (10) or A' Thammasat The processdefined by the Ito integral in (3) is a Martingale, i.e., the conditional whilethe e x p e c t a t i o n E l lYY, , , r ( s < l ] = { , Stratonovich integral { (l) is not. This property provides the expectation computation advantage for an Ito equation,which is very convenient for theoretic moment stability analysis. Moreover, because of more restrictive conditions on the existence of Stratonovich integrals, an Ito equation is suited for more general applications than a Stratonovich equation. o . 2 0.3 0 1 Modeling of an RC 3. Deterministic Circuit Let QQ) be the charge on the capacitor and V (t) be the potential source applied to the input 04 0.5 I 06 0.9 07 Fig. 1 Brownian motion processB, (l) of a RC circuit. Using Kirchoff s secondlaw, : - o f t \ (14) L ' 1 t 1 =l ( r ) R + = : L and since IQ) = a91,114,, the following equationholds: (15) R Q ' Q ) +C - ' Q Q )= V ( t ) or tVQ) (16) Q ' Q ) +( R C ) - ' Q Q )= R function, continuous lf V (t) is a piecewise the solutionof the first order linear differential (16)is: equation =0(o)"-e[-#) Q(t\ .*i.*(-?)nu,'" where p(0) the capacitor. , , i ! '-'n, 1nr ,,*1i 06 \ i ,li' j it't 4 ,,o1,ii;ri' I rr*iiI 1 -0 -0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0I 1 Fig. 2 Brownian motion processB, (l) known as the intensity of noise. Their magnitudes determine the deviation of the stochastic case from the deterministic one. The correlated process w(t) , sometimes called colored noise, can be generatedby a linear stochastic differential equation forced by white noise.which is givenas: (20) d,{t) = -pw(t)dt + o@B,(t) (l7) is the initial charge stored in 4. Stochastic Modeling of RC Circuit The resistanceand potential sourcemay not be deterministic but of the form : R'=R+"noise"=R+aw(t) , l 0.4 where B, (l) is a Brownian motion processwith unit variance parameter, P,o > 0 are fixed (18) constants and and wo - N(0,o2 pf 2) is where w(l) is a zero mean, exponentially independent of B, (l) . As we explained in section 2, (20;) is the same in the Ito and Stratonovich sense (since the coefficient of dB,(t) is nonrandom),and can be manipulated correlated stationary process, and N, (l) is a white noise process of mean zero and variance one,and a, B are nonnegative constants, by formal rules as if Bt(t) were continuously differentiable. Therefore equation (20) can be rewritten as: V' (t) = V(t) +"noise" :V(t) + BNr(t) (19) +J ThammasatInt. J. Sc. Tech.,Vol. 13, No. 2, April-June2008 dw(t\ (8,(r)\ B(r)=l I (30) dt where 1y',(r) is a zero mean, white Gaussian noise with E[Nr (/)Nr G)]= 5(t - r) . The function correlation of w(t) \8,(/), The analytical solution of (25) is a random process. i s R ". ( r ) : o 2 12e - o ' For large values of + process that approximateswhite noise. Substituting(18) and ( 1 9 )i n ( 1 5 ) ,w e g e t : If (n + aw(t))Q' Q)+ C' QQ)= v (t) + BN,(t) (22) differentialequation: riM(t\ or dt Taking the expectationof (3 1), we get: p,w(t) is dQV) a ,. the expectation E[X(0)Xr (0)] < - , = M(/) is the solution of the ordinary = A M ( r )+ E I Z ( r \ l (32) EIX(/)I= EIX(g)Iexp(Ar) R+aw(t) Q3) + [exp(A(r- s))E[z(s)lds ; O(t) '''' dt C(R + dw(t)) Q4) , BdBr(t) dt+ R+aw(t) R+aw(t) where dBr(t) = Nz(t)dt and Br(t) is the Brownian motion process, independentof B,(r) . Writing equations(20) and (24) in matrix-vector form,we obtain: dx(t) : A(t)x(t)dt + z(t)dt + K(/)dB(/) -r ( 31 ) t[X(l)] v(t) , BN^t) R + rxw(t) or dO(r\:- _ + K(s)dB(s)]) ll4slas Jexp(-As wide-band QU) C(R+aw(t)) dt X(r)= exp(ar){x1o; v(t) (2s) (33) for every / > 0. If the randomvariable X(0) is constantthen the expectationof the stochastic solution is equal to the deterministicsolution of the circuit. The tunction M(/): E[X(/)] is independentof the fluctuationalpart of the SDE. 5. Numerical Solutions of SDEs The Euler-Maruyamanumerical method is used for the simulationof X(r) [5]. The EulerMaruyama scheme is based on numerical methods for ordinary differential equations. Let the stochasticprocess X,,t, < t < T be the solution of the scalar SDE with M Brownian motion processes, M where dx, = f (X,,t)dt+Zs, (x,,t)dB,j /wff)) X(r):l I \Qtttl (- nw(t) (26) I ,,,, A(1)=lo C(R + dw(t)) ) \ ,?,, I z1r1=[ K ( / ) =ol I o P with an initial value X ,n = X o. Let us consider an equidistantdiscretizationof the time interval I n = ! o + n h , w h e r eh = ( T - r o ) fn = t n , t - l n tn-l : (28) the t R .- " ( r ) l (op e4) j=l )a, and the correspondingdiscretizationof motion Brownian process t,,t ) I LB!, = B,',., B;i, = . to be able to ,)dB! apply any stochasticnumericalscheme,first one has to generate, for all j, the random (2e) R+aw(t)) and incrementsof the Brownian motion process .Br 44 Fig. 4 The deterministic solution and sample path of the stochastic solution with stochastic resistance (noise intensitv a:l\. as independentGaussianrandom variableswith meanEfLBll = 0 and Et(LB;;'l: h. The Euler-Maruyamaschemefor this SDE has the form: M x n , t= x , , + f ( x , , t , ) h + l g , { x , , , t , ) L B 1 25_ (35) For measuring the accuracy of a numerical solution to an SDE, we use the strong order of convergence.A stochastic numerical scheme convergeswith strong order y, if thereexist real c o n s t a n tKs > 0 a n dd > 0 Ellx, - xin< Khl 2- 1 5 a [5],sothat: /ze(0,d) I (36) xi where the numericalsolution is denotedby The Euler-Maruyama scheme converges with y: strongordsr 1 l 1 : l I 0 0 / /Z 5 0 Fig. 5 The deterministic solution and sample path of the stochastic solution with stochastic potential source (noise intensitP Y:l). 6. Simulation Results The Brownian motion processesthat we use for the simulation of the stochasticsolution are shown in Fig. I and Fig. 2. Assume R=10O, C=0.1F, V(t)=V =20V, and X(0) = 0 .The resultsof the stochasticsolution l o 0 of the circuit with both stochasticresistanceand is s t o c h a s t i cp o t e n t i a l s o u r c e ( a = 7 , B = l ) shown in Fig. 3. A random behavior which dependson the intensity of noise is observedin Fig. 3. If the resistance is modeled as a superpositionof mean value plus a zero mean correlatedprocess,then an impact on the DC response is observed in Fig. 4. A random behavior is observedin Fig. 5, if the potential source is modeled as a superpositionof mean value plus a noise, where the noise is modeled as a white Gaussiannoise. Fig. 3 The deterministic solution and sample path of the stochastic solution with stochastic resistance and stochastic potential source (noise intensity a =l,F:l). ..-,.",...'l 7. Conclusion We have seenthat deterministicmodels are alvi'aysaccompaniedby stochasticones, which arise whenever we plug in random variables. Thesestochasticmodels are more appropriateto describe,for instance,the outcome of repeated experiments.This paper showsan applicationof the Ito stochastic calculus to the problem of modelinga seriesRC electricalcircuit, including 45 ThammasatInt. J. Sc. Tech.,Vol. 13. No.2. April-June200tt both analytical and numerical solutions. The stochastic model is obtained from the deterministicmodel by adding noise in both the potential source and the resistance.The noise addedin the potential sourceis assumedto be a white noise and that added in the resistanceis assumed to be a correlated process. The resulting SDE is solved using a non-Monte Carlo method. A monte Carlo method does not give explicit relation an expressing the sensitivity of the perfoffnancewith respect to input parametersand their tolerances.So, our methodcan be usedfor designoptimization. by formal rules as if Btft) were continuously differentiable.Therefore equation (39) can be rewrittenas: dw,(t\ - p , w , ( t l + o , P ,N (40) ,(t) dt where ly',(l) is a zero mean,white Gaussian n o i s e w i t h E I Nt Q ) N t G ) l = 6 ( t - r ) . T h e w,(t) of function correlation i s R , . ( r ) = o ,'t 42 e p,,w(t) Appendix A. Generalizationo./the Method Considera linear circuit that is built out of resistors.capacitorsand inductors. v(f) is the a F o r l a r g e v a l u e so f wide-band process that approximateswhite noise.Let X(t) be the state vector,which is definedas : X(r) : [w,(r) ]r:(/).. .w,,(t) r, (/)' . .x,,(/)l' (41) input pr6cessand ,t(t) the output process.r(t) satisfiesthe differentialequation: If the potentialsourceis modeledas a of meanvalueplusa whitenoise, superposition then this state vector satisfiesthe following SDEs: dw,(t): *ptwt|)dt + o,p,dB,(t) (37) s t . a . , " ' , a u a r et u n c t l o n s T h e p a r a m e t e rQ of the circuit elements. These parameters becomerandom variablesif they are influenced by random parameters such as surrounding temperature.Theseparameters,with the random variationscan be written as : (38) u) = a, + a,w,(t) where w,(/)s are zero mean exponentially con'elatedprocessesand a, s are nonnegatlve constantsknown as the intensityof noise.Their magnitude determines the deviation of the stochasticcase from the deterministicone. The corelated proccss u', (t) , sometimes called colorednoise,can be generatedby a linear SDE tbrcedby white noise[9]. thr,(t)= -pr||iQ)dt + o,p,dB,(t) 1< i< n (39) where B,(l) is a Brownianmotion process with unit varianceparameter,p,,o,>0 is " ' are f i r e d c o n s t a n t as n d w , ( 0 ) - - 1 V ( 0o. t p , f 2 1 ; t i n d e p e n d e not f B , ( t ) . A s w e c x p l a i n e di n section 2. (39) is thc same in the lto and Stratonovichsense (since the coefficient of dB (t) is nonrandom).and can be rnan:ipulated 46 dw,,(t)= | p,,*,,(t)dt+ o, p,dB,(t) dx,(t)= x.(t)dt dxr(t): x1ft)dt : dx,,,(t) = x,,(t)dt (t ) = -bi r,,(t) + al x,,, ( t ) +' " + ai,x, ft \pt clx,, + v(t)dt+ BdB(t) 8. References tll M. Vargas and R. Pallas-ArenY,On Resistor-introduced Thermal Noise in Linear Circuits. IEEE Transactions on Instrumentationand Measurement,Vol. 4 9 . N o . l , p p .8 7 - 8 8 , 2 0 0 0 . l2l Romano Giannetti, On the Thermal Noise Introducedby a Resistorin a Circuit, IEEE Transactions on Instrumentatton and Vol. 45, No. 1, pp.345-347, Measurement, t996. t3l P. J. Fish, ElectronicNoise and low noise Design,New York: McGraw-Hill,1993. Ito, On Stochastic Differential I4l K. Equations,in Mem. Amer. Math. Soc..4, p p . l - 5 1 ,1 9 5 1 . ThammasatInt. J. Sc. Tech., Vol. 13, No.2' April-June200ti t5l T. C. Gard, Introduction to Stochastic Differential Equations, Marcel Dekker, New York, 1988. [6]5. Kalpazidou,Circuit Duality for Recurrent Markov Processes,Circuits, Systems,and Signal Processing,Vol. 14, No. 2, pp. 187-211.r99s. l7l S. Kalpazidou, On the Representationof Finite Markov Chains by Weighted Circuits,J. MultivariateAnal., Vol. 25, No. 2 , p p . 2 4 1 - 2 4 71, 9 9 8 . t8l S. Kalpazidou, Asymptotic Behavior of Sample Weighted Circuits Representing Recurrent Markov Chains, J. Appl. Prob., Y o l . 2 1 , p p .5 4 5 - 5 5 61, 9 9 0 . [9] Andrew H. Zazwinski, Stochastic Process and Nonlinear Filtering Theory, Academic Press,New York, 1970. [10] Takao Ishii, MasahiroNakayama,Teruyuki I. Fujishiro, Hiroki and Takei, Determinationof Small Signal Parameters and Noise Figures of MESFET's bY Circuit SimulatorEmploying Physics-based Monte Carlo Technique, in IEICE 41 on Electronics,E86-C,No. 8. Transactions pp. 1472-1479,2003. Il]Kettani Houssain,and BarmishB. Ross,A New Monte Carlo Circuit Simulation Paradigm with Specific Results fbr Resistive Networks. in IEEE Transactions on Circuits and SystemsI: Regular Papers' Vol.53,No.6, pp. 1289-1299,2006. Su, and K. Strunz, StochasticCircuit Q tl2l Modeling with Hermite Polynomial Chaos, in ElectronicLetters,Vol. 41, No. 21, pp. I 163-165,2005. R. L. Stratonovich,A New Representation tl3l of StochasticIntegrals and Equations, in SiamJ. Control,4, pP.362-371,1996. Stochastic Differential Arnold, tl4l L. Equations,J. Wiley Sons,New York, 1974. t15] E. Wong. StochasticProcessin Information and Dynamical Systems. New York: McGraw-Hill, 197,. [16] R. E. Mortensen,MathematicalProblems of Modeling StochasticNonlinear Dynamic Systems,in J. Stat.Physics,Vol. l, No 2' pp.27 1-296, t969.