You are on page 1of 4

Name: BULAC, RICKY C.

Course and Year: BSEE-5


EE 179.1 Section: W45 Laboratory Schedule: Saturday, 12:00-3:00PM

Activity 4: Modeling in Time Domain


1 Objectives
 To be able to represent and manipulate a linear time-invariant system in a computer in time
domain.
 To know how to convert from transfer function to state space representation using a
mathematical software.
 To know how to convert from state space representation to transfer function using a
mathematical software.

2 List of equipment/software
 Personal Computer
 Installation of SCILAB

3 Overview
You have been introduced to frequency domain modeling (classical approach) as a way to
represent linear time-invariant system. Equations of most system dynamics contain integral and
derivative terms. By solving these equations in frequency domain, we can generate mathematical
models algebraically. You get transfer functions for each system which can simplify modeling
interconnected subsystems.

An alternative way is to model in time domain. State-space representation is an approach for


modeling control systems in time domain. It directly provides model in time-domain(the thing of
interest) compared to the classical approach where you have to convert the frequency domain
solution to time-domain. State-space representation can conveniently handle systems with multiple
input and output and systems with non-zero initial conditions. This approach can also provide
variables that describe the internal state of the system. The models in this approach are
represented in first order differential equations so less integrations and differentiations is required.

Another thing that makes state-space attractive is that it is represented in matrix form which
can be easily used in digital computer systems. Several mathematical software packages exist like
Matlab and Scilab that supports state-space operations.

In this activity, you will be using the state-space approach with the aid of Scilab. You will be
solving a problem and represent it’s model in frequency domain and state-space.

4 State-Space Representation in Scilab


A model in state-space is represented by the following equations:
Name: BULAC, RICKY C. Course and Year: BSEE-5
EE 179.1 Section: W45 Laboratory Schedule: Saturday, 12:00-3:00PM

𝑥̇ = 𝐴𝑥 + 𝐵𝑢

𝑦 = 𝐶𝑥 + 𝐷𝑢

for 𝑡 ≥ 𝑡0 and initial conditions, 𝑥(𝑡0 ), where

𝑥 = state vector
𝑥̇ = derivative of the state vector with respect to time.
𝑦 = output vector
𝑢 = input vector
𝐴 = System matrix or matrix of the coefficients of the state variables in the state equation
𝐵 = input matrix or coefficients of the input
𝐶 = output matrix or the coefficients of the state variables in the output equation
𝐷 = feedforward matrix

Consider the simple circuit below.

Figure 4.1

Figure 4.1 has a state-space representation of:


𝑣𝐶̇ −1 1 𝑣𝐶 0
[ 𝑖̇ ] = [ ] [ ] + [ ] 𝑉2
𝐿 −1 0 𝑖𝐿 1
𝑣𝐶
𝑦 = [1 0] [ 𝑖 ]
𝐿
Enter this in scilab:
--> A= [ -1, 1; -1 0];
--> B= [0; 1];
--> C= [1, 0];
Name: BULAC, RICKY C. Course and Year: BSEE-5
EE 179.1 Section: W45 Laboratory Schedule: Saturday, 12:00-3:00PM

Scilab represents state-space as a list. You must call syslin(‘c’,A,B,C) to format A, B, and C matrices
as a state-space list in scilab. The ‘c’ in the first argument tells the function to represent a continuous-
time system.
--> sl = syslin(‘c’,A , B, C);

Now you have a state-space model of the circuit in Figure 4.1. You can use this model with csim()
to get the response of the system.
1. What would be the plot the response of the system if the input is a step input?
The plot of the response is shown in Act4.1.JPG.
2. Write the transfer function of the system by hand(using Laplace transform). Using csim(), plot
the reponse of the system for the transfer function. Describe the previous plot and the
current plot.
𝒔𝒊𝑳 = 𝑽𝟐 − 𝒗𝑪
−𝒗𝑪 + 𝑽𝟐
𝒊𝑳 =
𝒔
−𝒗𝑪 + 𝑽𝟐
−𝒗𝑪 + = 𝒔𝒗𝑪
𝒔
𝒔𝟐 𝒗𝑪 = −𝒔𝒗𝑪 − 𝒗𝑪 + 𝑽𝟐
(𝒔𝟐 + 𝒔 + 𝟏)𝒗𝑪 = 𝑽𝟐
𝒗𝑪 𝟏
= 𝟐
𝑽𝟐 𝒔 + 𝒔 + 𝟏
The plot of the response of the system for the transfer function above is shown in Act4.2.JPG.
The plot of this system is the same compared to the plot of the previous one.
You can convert a state-space representation to transfer function and transfer function to state-
space representation. In the lecture we derived the transfer function from the state-space
representation using this equation:
𝑌(𝑠)
𝐺(𝑠) = = 𝐶(𝑠𝐼 − 𝐴)−1 𝐵 + 𝐷
𝑈(𝑠)
3. Using the above equation, get the transfer function of the function. Compare the transfer
function you got from the previous instructions and the transfer function you got the above
equation.
The transfer function is the same compared to the previous function. This can be seen in
Act4.3.JPG.

4.1 Scilab ss2tf()


Scilab has a function to convert a state-space representation to transfer function. ss2tf() accepts a
scilab state-space object and returns the transfer function equivalent.
4. Use ss2tf() to get the transfer function. Compare the result to the previous transfer functions.
Did you get different results? If yes, why?
The result shown in Act4.4.JPG is still the same as the previous functions.
Name: BULAC, RICKY C. Course and Year: BSEE-5
EE 179.1 Section: W45 Laboratory Schedule: Saturday, 12:00-3:00PM

4.2 Scilab tf2ss()


Scilab can also provide the state-space representation given a transfer function. tf2ss() accepts a
transfer function and returns the syslin() formatted state-space representation.

5. Using the transfer function you obtain by hand, pass it as a parameter in tf2ss() and write the
result. Did you get the same state-space representation from the given? If not, explain the
possible reason and show the plot of the response of this state-space on a step input.
The A matrix obtained is different from the state space given. However the obtained A matrix
is an equivalent of the A matrix of the given state space therefore the obtained state space is
the same as the given state space. It is proved by obtaining the plot of the obtained state
space which is the same as the previous plot. Shown in Act4.5.JPG is the plot.

6. Manualy, convert the transfer function obtained by hand to state-space(phase-variable


method). Is resulting state-space the same with the previous state-space representations? If
not, why? Show the plot of response of this state-space on a step input.
𝑿(𝒔) 𝟏
= 𝟐
𝑹(𝒔) 𝒔 + 𝒔 + 𝟏
(𝒔𝟐 + 𝒔 + 𝟏)𝒙 = 𝒓
𝒙̈ + 𝒙̇ + 𝒙 = 𝒓
𝒙 = 𝒙𝟏 ; 𝒙̇ = 𝒙𝟐 ; 𝒙̈ = 𝒙𝟐̇
𝒙𝟐̇ = −𝒙𝟏 − 𝒙𝟐 + 𝒓
𝒙 ̇ 𝟎 𝟏 𝒙𝟏 𝟎
[ 𝟏] = [ ] [ ] + [ ] [𝒓]
𝒙𝟐̇ −𝟏 −𝟏 𝒙𝟐 𝟏
𝒙𝟏
𝒚 = 𝒙𝟏 = [𝟏 𝟎] [𝒙 ]
𝟐
The result is still the same. The plot shows the same response as the previous one. Shown in
Act5.6.JPG.

You might also like