kill(all)$

electrical (3) ,How to find differential equations 'rlc circuit' in general. "version 1.0",part 1
peter.vlasschaert@gmail.com,22/12/2019

load packages
---------------------

load(lrats)$

Definition : KVL,KCL
================

Definition : KVL
============

 the 'algebraic sum' of "all the voltages" around any "closed loop in a circuit is equal to zero".

Vs = i*R1+i*R2

KVL =Kirchoff  Voltage Law
======================
Vs -i*R1-i*R2 = 0
general
======
sum (Vi,i,1,n)  = 0  , n = integer , closed 'loop'

rem : Vs called a source

Definition : KCL
============

the total current entering a circuits junction is exactly equal to the total current leaving the same junction

KCL = Kirchoff   Current Law
======================
i1+i2 -iT =0
general
======
sum(Ij,j,1,n) = 0 , n = integer ,@ 'junction' 

passive elements circuits
===================

v = voltage         (unit = Voltage)
i = current           (unit = Ampere)
z = impedance   (unit   ? , ≠       )

time domain :
==========

a)  Resistor'R' (Ohm,Ω)
=========
impedance = Z ( unit : Ohm =Ω)

resistor ( example:xcos)

p1: v = i*Z;
p1a:v = i*R;

b)  Capacitor'C' (Farad,F)
==========

capacitor (example:xcos)

p2:i=C*diff(u(t),t);
p2a:v= 1/C*integrate(i(t),t,0,t);

b)  Inductor 'L'(Henry,H)
===========

inductor ( example:xcos)

p3:v=L*diff(i(t),t);
p3a:i=1/L*integrate(u(t),t,0,t);

s domain :  conversion ' t domain ' => ' s domain '
========

d/dt               =>  s
integrate      =>   1/s
rem : s = j*ω = j*2*π*f,  j = sqrt(-1) ,j =complex number
          f = frequency  > 0
          T= period       > 0
rem : T*f = 1

rem :  scilab => prompt type   xcos  ( ' in scilab')

general : impedance ' rlc circuit ', serial connection.
=======================================

 rlc  circuit 'example '

time domain
==========

p4:i= (VA-VB)/Z;

voltages
------------

p4a:VR = i(t)*R;
p4b:VC =rhs(p2a);
p4c:VL  =rhs(p3);

suppose volage between (VA,VB) = V
=============================

p4d: V = VR+VC+VL;

p4e:lhs(p4d)=rhs(p4a+p4b+p4c);

differential equation : rlc circuit
------------------------------------------

p4e:'diff(V,t) = diff(rhs(p4e),t);

part 2 : solve equation   'p4e' = second order differential equation.
( second : highst power of differential in 'p4e')

rem : s - domain needed for control theory  ' 2020 series'

How to find  complex impedance :  'use s domain conversion'
===============================================

p5a :ZR = R;
p5b :ZC = 1/(s*C);
p5c: ZL  = s*L;

total impedance : Z
===============

p6:Z = rhs(p5a)+rhs(p5b)+rhs(p5c);

p6a:ratsimp(p6);

find zeros numerator 'p6a'
================

p6b: num(rhs(p6a)) = 0;

roots : quadratic equation 'p6b'
-------------------------------------------

p6c:solve(p6b,s);

check : first root
============

p6d : subst([p6c[1]],p6b);

p6d1:ratsimp(p6d);

check : second root
================

p6e : subst([p6c[2]],p6b);
p6e1:ratsimp(p6e);

total complex impedance
====================
%i = sqrt(-1)

j:sqrt(-1);
p7:s=j*2*π*f;
p7a:s=j*ω;

p7b:subst([p7a],p6a);

p7c:lhs(p7b)=expand(rhs(p7b));

complex number :  z = a*%i+b
=======================

1e) How to a: ' complex part'
==========

p8a:a=imagpart(rhs(p7c));

2e) How to a: ' real      part'
==========

p8b:b = realpart(rhs(p7c));

                  resonance frequency ( = fr) > 0
               ==========================
Definition when realpart is zero (b = 0),solve :a=0 for ω find fr.

p9:solve(rhs(p8a)=0,ω)[2];

p9a:ω=2*π*fr;
p9b:subst([p9a],p9);
p9c:solve(p9b,fr)[1];