0% found this document useful (0 votes)
9 views

Nikhilcslab4

The document outlines a lab exercise focused on converting transfer functions to state-space models and vice versa using MATLAB and Simulink. It includes problem statements, background theory, mathematical modeling, implementation steps, results, and analysis for both conversions. The conclusion emphasizes the importance of understanding both representations in control engineering for effective system analysis and design.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Nikhilcslab4

The document outlines a lab exercise focused on converting transfer functions to state-space models and vice versa using MATLAB and Simulink. It includes problem statements, background theory, mathematical modeling, implementation steps, results, and analysis for both conversions. The conclusion emphasizes the importance of understanding both representations in control engineering for effective system analysis and design.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

LAB-4 Date:/03/2024

Problem Statement:

Q1. Convert the given transfer function into a state space model
Y (s ) 2
s +7 s+2
= 3
U ( s ) s +26 s2 +9 s+24

Q2. Convert the given State space model to transfer function

x=
'
[−31 −31 ] x +[ 12] u
y= [ 2 3 ] x+1 u

Background Theory and Analysis:


In control systems, a state-space model, also known as a state-variable representation or
simply a state-space representation, is a mathematical representation of a dynamic system. It
is a common and powerful way to describe the behaviour of linear time-invariant (LTI)
systems, which are systems whose parameters and equations do not change with time.
A state-space model is typically represented by a set of first-order differential equations, and
it describes the system in terms of its state variables, input signals, and output signals. In
MATLAB, we can create and manipulate state-space models using the Control System
Toolbox.

Y ( s ) ( Y ( s )∗X 1 ( s ) )
Let =
U ( s ) X 1 ( s )∗U ( s )

Y (s)
On comparing numerator part of transfer function with ,
X1 (s )

Y (s)
We get =s 2+ 7 s+ 2
X1 (s )
2
Y ( s )=s X 1 ( s ) +7 s X 1 ( s )+ 2 X 1 ( s )
'' '
y=x 1 + 7 x 1=2 x 1 ...............................(1)

X1 (s )
On comparing denominator part of transfer function with, ,
U (s )
We get,

X1 (s ) 1
= 3
U ( s ) s +26 s +9 s+24
2

3 2
U ( s )=s X 1 ( s ) +26 s X 1 ( s )+ 9 s X 1 ( s )+24 X 1 ( s )
'' '' '
u=x1 + 26 x1 +9 x 1+24 ...................................(2)

We will use the 'ss2tf' function and the transfer function formula, which takes the state space
matrices (A, B, C, and D) as inputs and provides the corresponding transfer function
coefficients.

Mathematical Modelling:
From the phase variable relationship, we get :
'
x 1=x 2 ....................(3)
'' '
x 1 =x 2=x 3 ❑
.....................(4)
'' ' '' '
x 1 =x 2 =x3 .....................(5)

Using eqn (3), eqn (4), eqn (5) in eqn (1),

We get,

y=x 3 +7 x 2 +2 x 1

y=2 x 1 +7 x2 + x 3 ...................(6)

Similarly Using eqn (3), eqn (4) and eqn (5) in eqn (2).

We get:
'
u=x3 +26 x 3 +9 x 2+ 24 x 1
'
x 3=−24 x 1−9 x 2−26 x 3 +u ....................(7)
Implementation and Verification of Model in MATLAB/Simulink:

Simulink Method for Q1:

In1
1 1 1
s s s

Gain
Integrator Integrator1 Integrator2

Subtract
1

Gain2 Out1

Add

Gain1

Gain3

Gain4

Fig 1: Mathematical model representing the state space model of the system

Matlab codes:

Fo Q1. Simulink Method:


[A,B,C,D]=linmod('CS_LAB4')

Formula Method
clc;
close all;
clear;
num=[1 7 2]
den=[1 26 9 24]
[A1 B1 C1 D1]=tf2ss(num,den)
p=[0 0 1; 0 1 0; 1 0 0]
A=inv(p)*A1*p
B=inv(p)*B1
C=C1*p
D=D1

for Q2. Method-1


clc;
close all;
clear;
syms s;
A=[-3 1; 1 -3];
B=[1;2];
C=[2 3];
D=1;
I=[1 0; 0 1];
T=C*(inv(s*I-A))*B+D
for Q2. Methode-2
clc;
close all;
clear;
A=[-3 1; 1 -3];
B=[1;2];
C=[2 3];
D=1;
[num den]=ss2tf(A, B, C, D)
T=tf(num,den)

Result and Analysis:


Result of Q1.

Simulink Method
A =

0 1 0
0 0 1
-24 -9 -26

B =

0
0
1

C =

2 7 1

D =

Formula Method Q1.

num =

1 7 2
den =

1 26 9 24

A1 =

-26 -9 -24
1 0 0
0 1 0

B1 =

1
0
0

C1 =

1 7 2

D1 =

p =

0 0 1
0 1 0
1 0 0

A =

0 1 0
0 0 1
-24 -9 -26

B =

0
0
1

C =

2 7 1
D =

Analysis of result of Q1:

 A is a square matrix of size 3x3. It represents the system's dynamic behaviour or


state-transition matrix.
 B is a matrix of size 3x1. It is a representation of the input-to-state mapping, which
specifies how control inputs impact state variables. The third state variable is directly
influenced by the input.
 C is a matrix of size 1x3. It represents the state-to-output mapping, which specifies
how the system's outputs are related to the state variables.
 D is a scalar value and is often referred to as the feed forward matrix. It represents any
direct feed through from the input to the output. In this case, D is equal to 0, which
suggests that there is no direct transmission from the input to the output.

Result of Q2.

Method-1 for Q2.

T =

7/(s^2 + 6*s + 8) + (8*(s + 3))/(s^2 + 6*s + 8) + 1

Method-2 for Q2.


num =

1.0000 14.0000 39.0000

den =

1 6 8

T =

s^2 + 14 s + 39
---------------
s^2 + 6 s + 8

Continuous-time transfer function.

Analysis of result of Q2.


 num and den vectors are used to represent the numerator and denominator coefficients
of a transfer function in control systems.
 The transfer function can be expressed as T = num(s)/den(s).
 The transfer function provides a convenient representation of a system's behaviour in
the frequency domain, making it easier to perform analysis and design tasks.
 The poles at s = -2 and s = -4 in the denominator indicate that the system has two
distinct real poles, suggesting the system is stable.

Conclusion
In this lab we learnt to convert transfer function to state space model and vice-versa by using
Simulink model and MATLAB. State-space models are more detailed and versatile, making
them suitable for complex systems and advanced control techniques. On the other hand,
transfer functions provide a simpler and more intuitive representation for frequency domain
analysis, making them useful for basic control system design and analysis. The conversion
between these two representations is a valuable tool in control engineering, allowing
engineers
to choose the most appropriate model for their specific needs.

Name- Nikhil Singh


Regd. No- 2251019012

You might also like