RLC circuit - a state space representation

A state space representation and a transfer function designating for a RLC circuit. The considered circuit has in its topology: an inductivity, a capacitor and a resistor. All elements are connected in series. The input voltage is between start and end terminals of the circuit and it represents the input signal. The output voltage is the voltage on capacitor and it represents the output signal. One of capacitor's terminals is connected to the ground.

A state space representation for RLC circuit - example 1

state space representation - RLC circuit example 1.

For the electric RLC circuit shown above, the dynamic models will be designated. The first dynamic model will be in form of a transfer function. The second dynamic model will be in form of state space representation equations. Start conditions (initial conditions) for this example are equal to zero (ST=0). The circuit’s output voltage (the output signal) is capacitor C voltage u_c(t).

A dynamic model of circuit RLC in form transfer function H(s)

The subject RLC circuit is treated like a voltage divider. Its resultant impedance will be computed in a Laplace transformation form. Initial conditions of the Laplace transformation are assumed as 0, thus, all components of the Laplace transformation, which are dependent on initial conditions, are equal to zero (ST=0).

state space representation - RLC circuit equation 1.

Output voltage U_2 (s) is given by a following formula

state space representation - RLC circuit equation 2.

A dynamic model in form of state space representation equations

General form of state space representation equations is following:

state space representation - RLC circuit equation 3.

Where:
[A]- state matrix, [B]- input matrix, [C]- output matrix, [D]- feedthrough matrix

Designation of the state space representation equations by writing down Kirchhoff’s voltage law (KVL) equation for the circuit.

state space representation - RLC circuit equation 4.

Because elements R,L,C are connected in series then:

state space representation - RLC circuit equation 5.

The equation above is rewritten in the way which places the derivative of the biggest degree at the left side of equation.

state space representation - RLC circuit equation 6.

The state space representation, the state matrix [A] and the input matrix [B]:

state space representation - RLC circuit equation 7.

The state space representation, the output matrix(vector) [C] and the feedthrough matrix(vector) [D]:

state space representation - RLC circuit equation 8.

Simulations in MATLAB

Two dynamic models, i.e. mathematical models, have been designated for the RLC circuit. The first model is in form of the transfer function H(s). The second model is in from of the state space representation equations. At this point, all necessary data to execute simulation in MATLAB is in place.

Simulation in MATLAB through transfer function H(s)

A simulation of system’s response for a jump extortion it’s possible through a MATLAB’s lsim function. Firstly, a m-file needs to be created; it will contain parameters of the RLC electric circuit.
lsim(c,d,uin,t)
where:
c – vector with factors from counter of transfer function H(s)
d – vector with factors from denominator of transfer function H(s)
uin – vector with values for extortion
t – time vector
A sample code for executing simulation:
R=100;%resistance value
L=0.01;%inductivity value
C=0.001;%capacity value
t=0:0.000001:1;%time vector definition
uin=ones(1,length(t));%definition for unit extortion with application of ones function
c=[1];%vector with transfer function counter factors
d=[L*C R*C 1];% vector with transfer function denominator factors
lsim(c,d,uin,t);
c=[1];%vector with transfer function counter factors
d=[L*C R*C 1];% vector with transfer function denominator factors
lsim(c,d,uin,t);

Simulation in MATLAB through via state space representation

MATLAB is really a very powerful calculation tool. It has in its resources a bunch of functions which allow to plot: an impulse response characteristic, a step response characteristic and even the frequency response characteristics.
impulse(A,B,C,D)
step(A,B,C,D)
bode(A,B,C,D)
Using specified above functions, characteristics of object can be plotted with ease. It is necessary to give input parameters as: the state matrix, the input matrix, the output matrix and the feedthrough matrix. In the considered example, the appearance of input parameters is following:

state space representation - RLC circuit equation 9.

MATLAB gives a possibility to create custom functions i.e. a custom library functions. A plenty of functions which are in MATLAB’s library were defined by users and shared with others. Therefore, everybody can contribute in the development of MATLAB's libraries.