A state space representation and a transfer function H(s) designating for RLC circuit. An electric circuit has in its topology: an inductivity, a capacitor and a resistor. All elements are connected in series. Input voltage is between start and end terminals in circuit. Output voltage is voltage on inductivity. One of inductivity terminals is connected to the ground.
Two dynamic models will be designated for RLC circuit with four terminals. The RLC circuit shown above will be modeled in forms of: a Laplace transfer function and the state space representation equations. It is assumed that start conditions for the Laplace transformation are equal to zero (ST=0).
The subject electric RLC circuit is in essence a voltage divider. Its resultant impedance will be designated as the Laplace transformation form. Calculations are based on assumption that the initial conditions for the Laplace transformation are equal to zero (ST=0).
It should be noted that
Using the equation for output voltage U_2(s) the transfer function H(s) can be computed as H(s) = U_2(s) / U_1(s).
The general form of the state space representation equations is following:
Where:
[A]- state matrix, [B]- input matrix, [C]- output matrix, [D]- feedthrough matrix
Because elements R, L, C are connected in series then:
The equation is rewritten in a way which places a derivative of the biggest degree at the left side of equation.
The state space representation, the state matrix [A] and the input matrix [B]:
The state space representation, the output matrix(vector) [C] and the feedthrough matrix(vector) [D]:
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.
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
An sample code for executing the 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=[L];%vector with transfer function counter factors
d=[L R 1/C];% vector with transfer function denominator factors
lsim(c,d,uin,t);
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:
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.