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

LCS Lab 05

This document discusses a lab experiment on state space modeling and system responses. The lab covers creating state space models in MATLAB and LabVIEW, finding responses to various inputs, and interconnecting systems. Students learn to convert between frequency and state space representations, determine responses using functions and blocks, and connect multiple systems.

Uploaded by

Ahmed Razi Ullah
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)
16 views

LCS Lab 05

This document discusses a lab experiment on state space modeling and system responses. The lab covers creating state space models in MATLAB and LabVIEW, finding responses to various inputs, and interconnecting systems. Students learn to convert between frequency and state space representations, determine responses using functions and blocks, and connect multiple systems.

Uploaded by

Ahmed Razi Ullah
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/ 23

Faculty Member: Sir Yasir Rizwan Date: 5/03/2024

Semester: 6th Semester Section: BEE – 13B

Department of Electrical Engineering

PLO4/ PLO4/ PLO5/ PLO8/ PLO9/


CLO5 CLO5 CLO6 CLO7 CLO8

Name Reg. No Viva / Quiz Analysis Modern Ethics and Individual


/ Lab of data in Tool Usage Safety and Team
Performanc Lab Work
e Report

5 Marks 5 Marks 5 Marks 5 Marks 5 Marks


AHMED RAZI ULLAH 366191

MUSTAFA ALI 372704

MUHAMMAD OMAIS 390616

EE-379: Control Systems

Lab No 5: State Space, Response of Systems to various inputs, and


interconnection of systems
1. Introduction:
In this lab, we will be using both MATLAB and LabVIEW to create state space models of
systems and find the responses of systems to various inputs. State space is a method to
model dynamic systems in time-domain and is an alternative to modeling in frequency
domain using Laplace. We will also learn functions in MATLAB that are used to
interconnect multiple systems together.

2. Objectives:
For attempting this lab, we need to remember the things that we learnt in previous labs. We
will be working with the transfer functions of motor and pendulum that we already made in
MATLAB and the DC motor model we made in LabVIEW.

It is expected that after finishing this lab, we will have learnt the basics of state space
modeling in MATLAB and LabVIEW. We will be familiar with how to convert
between frequency domain and state space representations of systems in MATLAB,
how to know the response of various inputs to a system using functions in MATLAB
and blocks in Simulink, determine system response using LabVIEW, and interconnect
systems together.
EXERCISE 1

MATLAB CODE

J=1.84*(exp(-6));
m=0.027; r=0.0826;
Kg=1;
Jm=1.8*exp(-4);
ng=1; nm=0.69;
L=0.0955;
g=9.8;
Kt=0.0334;
R=8.7; e=2.178;

a=J+m*(r^2)+ng*J*(Kg^2);
b=m*L*r; c=(4*m*(L^2))/3;
d=m*g*L;
f=(ng*nm*Kg*Kt)/R;

numS=[f*c 0 -d*f];
denS=[(a*c-b^2) e*c -a*d -
e*d]; ms_tf=tf(numS, denS)
ms_ss = ss(ms_tf)

OUTPUT

3|Page
4|Page
MATLAB CODE

den=[a*c-(b^2) e*c -a*d -e*d


0]; num=[f*c 0 -f*d];

5|Page
OUTPUT

6|Page
7|Page
MATLAB CODE

den=[a*c-(b^2) e*c -a*d -e*d


0]; num=[f*b 0 0];

OUTPUT

8|Page
9|Page
Example 2 ( State Space representation of RLC circuit in LabVIEW)

Figure 4: Block Diagram

Figure 5: Settings for state space representation


EXERCISE 2

MATLAB CODE

10 | P a g e
num = 11.624; den
= [1 1.193e04];
G_s = tf(num,den);

MATLAB CODE

num = 11.409;
den = [1 1.193e04 0];
G_s = tf(num,den);

MATLAB CODE

a = 3.6605e-04; b =
2.1298e-04; c
= 3.2833e-04;
d = 0.0253; e
= 2.718; f =
0.0026;
num = [b*f, 0];
den = [(a*c-b^2), e*c, -d*a, -e*d];
G_s = tf(num,den);

EXERCISE 3

BLOCK DIAGRAM

11 | P a g e
BLOCK DIAGRAM

12 | P a g e
BLOCK DIAGRAM

13 | P a g e
EXERCISE 4

14 | P a g e
EXERCISE 5 (IMPULSE RESPONSE)

MATLAB CODE

num = 11.624;
den = [1 1.193e04];
G_s = tf(num,den);
impulse(G_s);

MATLAB CODE

clear all;
num = 11.409;
den = [1 1.193e04 0];
G_s = tf(num,den);
impulse(G_s);

15 | P a g e
MATLAB CODE

num = [b*f, 0];


den = [(a*c-b^2), e*c, -d*a, -e*d];
G_s = tf(num,den);
impulse(G_s);

16 | P a g e
EXERCISE 6

MATLAB CODE

num = 11.624;
den = [1 1.193e04];
G_s = tf(num,den);

t = 0:0.1:5;
u = t;

lsim(G_s,u,t);

MATLAB Code

num = 11.624;
den = [1 1.193e04];
G_s = tf(num,den);
T = 5;
[u,t] = gensig("square", T,30,0.1);

17 | P a g e
MATLAB CODE

num = 11.624;
den = [1 1.193e04];
G_s = tf(num,den);

[u,t] = gensig("sine", 0.3142, 10, 0.0005);


lsim(G_s,u,t);

EXERCISE 7

MATLAB CODE

syms s;
step_input = 1/s ; G1 = 11.62/(s+11930);

Gs = G1 * step_input;

res = ilaplace(Gs);

18 | P a g e
OUTPUT

This expression obtained for step response agrees with the plots we had obtained earlier for
step response. The response eventually settles to the value 9.7402e-04 and our plots verify this.

MATLAB CODE

syms s; ramp_input = 1/(s^2) ; G1 =


11.62/(s+11930);

Gs = G1 * ramp_input;
res = ilaplace(Gs);

OUTPUT

19 | P a g e
MATLAB CODE

syms s;
impulse_input = 1; G1 = 11.62/(s+11930);

Gs = G1 * impulse_input;

res = ilaplace(Gs);

OUTPUT

EXERCISE 8

MATLAB CODE

20 | P a g e
num1 = (5);
den1 = (1);
H_s =
tf(num1,den1); num =
11.624; den = [1 1.193e04];
G_s = tf(num,den);
sys = feedback(G_s,H_s);

21 | P a g e
OUTPUT

22 | P a g e
Conclu
sion

In thislab, we were presented with novel ideas in system modeling. We developed


state-space models using MATLAB and LabVIEW, and gained insights into the
different responses achievable by implementing diverse inputs inms.
dynamical syste
Thetheoretical understanding we acquired regarding state space modeling and
system interconnection can be effectively utilized for modeling systems in software
applications like MATLAB and LabVIEW
.

23 | P a g e

You might also like