Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Assignment No.

4: State Space (QUIZ)

HYA SHANE TADLAS TEJUME


April 25, 2024

1 State Space Model


Solve the transfer functions for all the elements as the output of the circuit shown below using the state
space model. The values of each circuit elements are L1,L2 = 2H, C1, C2 = 10 µF, and R1 = 10 Ω. The
voltages are V1 = 10 V and V2 = 10 V.

L1 L2
A

V1 + C1 + V2
− −

B
R1
C2

Figure 1: Circuit Diagram

   dVC1     
ẋ1 dt x1 VC1
ẋ2   dVC2  x2  VC2 
  =  didt  ;   =  
ẋ3   L1  x3   iL1 
dt
ẋ4 diL2 x4 iL2
dt
KVL at loop 1

−V1 (t) + VL1 + VC1 − VC2 = 0


diL1
−V1 (t) + L1 + VC1 − VC2 = 0
dt
1
ẋ3 = (−V1 (t) − x1 + x2 ) (1)
L1
KCL at node A

iL1 = iC1 + iL2


dVC1
C1 = iL1 − iL2
dt

1
ẋ1 = (x3 − x4 ) (2)
C1
KVl at loop 2
diL2
−VC1 + L2 + V2 (t) + VR = 0
dt
1
ẋ4 = (x1 − V2 (t) − R1 x4 ) (3)
L2
KCL at node B
iL2 = iC2 + iC1

1
dV2 dV1
C2 = C1 + iL2
dt dt
 
C1 1 1
ẋ2 = (x3 − x4 ) + x4
C2 C1 C2
1
ẋ2 = x3 (4)
C2

2 MATLAB
2.1 Tranfer Function at C1
Solving the Output of C1:
y(t) = VC1
y(t) = x1
Then, we set the state space matrices as

0 100 × 103 −100 × 103


   
0 0 0
3
 0 0 100 × 10 0  0 0 
A= −0.5 0.5
;B =  
0 0  0.5 0 
0.5 0 0 −5 0 −0.5
   
C= 1 0 0 0 ; D= 0 0
Solving For Transfer Function at C1:
>> % State space to transfer function
A = [0 0 100000 -100000; 0 0 100000 0; -0.5 0.5 0 0; 0.5 0 0 -5];
B = [0 0; 0 0; 0.5 0; 0 -0.5];
C = [1 0 0 0];
D = [0 0];

% State space model


sys = ss(A, B, C, D, 0.25);

% Transfer function for the first input (index 1)


[num1, den1] = ss2tf(A, B, C, D, 1);

% Transfer function for the second input (index 2)


[num2, den2] = ss2tf(A, B, C, D, 2);
G1=tf(num1,den1);
G2=tf(num2,den2);
>> G1

G1 =

50000 s^2 + 250000 s


---------------------------------------------
s^4 + 5 s^3 + 5e04 s^2 + 1.863e-09 s - 2.5e09

Continuous-time transfer function.

>> G2

G2 =

50000 s^2 + 1.421e-09 s - 2.5e09


---------------------------------------------
s^4 + 5 s^3 + 5e04 s^2 + 1.863e-09 s - 2.5e09

Continuous-time transfer function.

2
2.2 Transfer Function at C2
Solving the Output of C2:
y(t) = VC2
y(t) = x2
Then, we set the state space matrices as
0 100 × 103 −100 × 103
   
0 0 0
3
 0 0 100 × 10 0  0 0 
A= −0.5 0.5
;B =  
0 0  0.5 0 
0.5 0 0 −5 0 −0.5
   
C= 0 1 0 0 ; D= 0 0
>> % State space to transfer function
A = [0 0 100000 -100000; 0 0 100000 0; -0.5 0.5 0 0; 0.5 0 0 -5];
B = [0 0; 0 0; 0.5 0; 0 -0.5];
C = [0 1 0 0];
D = [0 0];

% State space model


sys = ss(A, B, C, D, 0.25);

% Transfer function for the first input (index 1)


[num1, den1] = ss2tf(A, B, C, D, 1);

% Transfer function for the second input (index 2)


[num2, den2] = ss2tf(A, B, C, D, 2);
G1=tf(num1,den1);
G2=tf(num2,den2);
>> G1

G1 =

50000 s^2 + 2.5e05 s + 2.5e09


---------------------------------------------
s^4 + 5 s^3 + 5e04 s^2 + 1.863e-09 s - 2.5e09

Continuous-time transfer function.

>> G2

G2 =

-2.5e09
---------------------------------------------
s^4 + 5 s^3 + 5e04 s^2 + 1.863e-09 s - 2.5e09

Continuous-time transfer function.

2.3 Transfer Function at L1


Solving the Output of L1:
y(t) = VL1
y(t) = L1 ẋ3
 
1
y(t) = L1 (−V1 (t) − x1 + x2 )
L1
y(t) = −V1 (t) − x1 + x2

3
Then, we set the state space matrices as
0 100 × 103 −100 × 103
   
0 0 0
3
 0 0 100 × 10 0  0 0 
A= −0.5 0.5
;B =  
0 0  0.5 0 
0.5 0 0 −5 0 −0.5
   
C = −1 1 0 0 ; D = −1 0
Solving For Transfer Function at L1:
>> % State space to transfer function
A = [0 0 100000 -100000; 0 0 100000 0; -0.5 0.5 0 0; 0.5 0 0 -5];
B = [0 0; 0 0; 0.5 0; 0 -0.5];
C = [-1 1 0 0];
D = [-1 0];

% State space model


sys = ss(A, B, C, D, 0.25);

% Transfer function for the first input (index 1)


[num1, den1] = ss2tf(A, B, C, D, 1);

% Transfer function for the second input (index 2)


[num2, den2] = ss2tf(A, B, C, D, 2);
G1=tf(num1,den1);
G2=tf(num2,den2);
>> G1

G1 =

-s^4 - 5 s^3 - 5e04 s^2 + 1.118e-08 s + 5e09


---------------------------------------------
s^4 + 5 s^3 + 5e04 s^2 + 1.863e-09 s - 2.5e09
Continuous-time transfer function.

>> G2
G2 =
-50000 s^2 - 7.85e-07
---------------------------------------------
s^4 + 5 s^3 + 5e04 s^2 + 1.863e-09 s - 2.5e09
Continuous-time transfer function.

2.4 Transfer Function at L2


Solving the Output of L2:
y(t) = VL2
y(t) = L2 ẋ4
 
1
y(t) = L2 (x1 − V2 (t) − R1x4 )
L2
y(t) = x1 − V2 (t) − R1x4

Then, we set the state space matrices as


0 100 × 103 −100 × 103
   
0 0 0
 0 0 100 × 103 0  0 0 
A= 
 ; B = 0.5
  
−0.5 0.5 0 0 0 
0.5 0 0 −5 0 −0.5
   
C = 1 0 0 −10 ; D = 0 −1
Solving For Transfer Function at L2:

4
>> % State space to transfer function
A = [0 0 100000 -100000; 0 0 100000 0; -0.5 0.5 0 0; 0.5 0 0 -5];
B = [0 0; 0 0; 0.5 0; 0 -0.5];
C = [1 0 0 -10];
D = [0 -1];

% State space model


sys = ss(A, B, C, D, 0.25);

% Transfer function for the first input (index 1)


[num1, den1] = ss2tf(A, B, C, D, 1);

% Transfer function for the second input (index 2)


[num2, den2] = ss2tf(A, B, C, D, 2);
G1=tf(num1,den1);
G2=tf(num2,den2);
>> G1

G1 =

50000 s^2
---------------------------------------------
s^4 + 5 s^3 + 5e04 s^2 + 1.863e-09 s - 2.5e09

Continuous-time transfer function.

>> G2

G2 =

-s^4 + 1.564e-13 s^3 + 2.691e-06 s^2 + 7.183e-10 s - 9.023e-25


--------------------------------------------------------------
s^4 + 5 s^3 + 5e04 s^2 + 1.863e-09 s - 2.5e09

Continuous-time transfer function.

>>

2.5 Transfer Function at R1


Solving the Output of R1:

y(t) = VR1 where VR1 = R1 × iL2


y(t) = R1x4

Then, we set the state space matrices as

0 100 × 103 −100 × 103


   
0 0 0
 0 0 100 × 103 0  0 0 
A= −0.5 0.5
;B =  
0 0  0.5 0 
0.5 0 0 −5 0 −0.5
   
C= 0 0 0 10 ; D = 0 0
Solving For Transfer Function at R1:
>> % State space to transfer function
A = [0 0 100000 -100000; 0 0 100000 0; -0.5 0.5 0 0; 0.5 0 0 -5];
B = [0 0; 0 0; 0.5 0; 0 -0.5];
C = [0 0 0 10];
D = [0 0];

5
% State space model
sys = ss(A, B, C, D, 0.25);

% Transfer function for the first input (index 1)


[num1, den1] = ss2tf(A, B, C, D, 1);

% Transfer function for the second input (index 2)


[num2, den2] = ss2tf(A, B, C, D, 2);
G1=tf(num1,den1);
G2=tf(num2,den2);
>> G1

G1 =

250000 s
---------------------------------------------
s^4 + 5 s^3 + 5e04 s^2 + 1.863e-09 s - 2.5e09

Continuous-time transfer function.

>> G2

G2 =

-5 s^3 + 6.102e-16 s^2 - 4.778e-11 s - 3.645e-16


------------------------------------------------
s^4 + 5 s^3 + 5e04 s^2 + 1.863e-09 s - 2.5e09

Continuous-time transfer function.

You might also like