The Step response of an RLC circuit in State Space Model


In this post we will see the step response of an RLC circuit using a matlab program.The initial conditions are current is 1ma and voltage across capacitor is 2V.


The state space representation of the above circuit is.

\begin{displaymath}\left(\begin{array}{c}\dot{x_1}\\ \dot{x_2}\end{array}\right)... ...d{array}\right)+ \left(\begin{array}{c}1\\ 0\end{array} \right)\end{displaymath}

\begin{displaymath}y=\left(\begin{array}{c}0&1\end{array}\right) \left(\begin{array}{c}x_1\\ x_2\end{array}\right) + 0\end{displaymath}

Here R =4.1K, L=1.7H and C=1$\mu$ F

\begin{displaymath}\left(\begin{array}{c}\dot{x_1}\\ \dot{x_2}\end{array}\right)... ...d{array}\right)+ \left(\begin{array}{c}1\\ 0\end{array} \right)\end{displaymath}

\begin{displaymath}y=\left(\begin{array}{c}0&1\end{array}\right) \left(\begin{array}{c}x_1\\ x_2\end{array}\right) + 0\end{displaymath}

A=[-241.76 -.588;10^7 0] % this is the matrix A
B=[1;0]                  % this is the matrix B
C=[0 1]                  % this is the matrix C
D=0                      % this is the matrix D
sys=ss(A,B,C,D)          % ss() is a function to form the state space
t=0:.00001:.01;          % take several time samples
for i=1:1:1001           % make an input matrix of desired length
    u(i)=10;
end
[y,t,z]=lsim(sys,u,t,[10^-3 2])% in this function the variable y has output values 
%t has time values and z has the values of state space variable
plot(z(:,1)) %plot the values of X1 which is first state space variable

% using full colon means all values to be more clear z(:,1) means all rows of first column
title(‘state 1’)
plot(z(:,2))
title(‘state 2’)

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s