Acs Anmol
Acs Anmol
ETEE-453
LAB PRACTICAL FILE
2
EXPERIMENT – 1
AIM: For the given train model, find the state space model.
THEORY:
In deriving a mathematical model for a physical system, one usually begins with a system of differential
equations. It is often convenient to rewrite, these equations as a system of first order differential equations.
We will call this system of differential equations as a state space representation. The solution to this system
is a vector that depends on time and which contains enough information to c ompletely determine the
trajectory of the dynamical system. This vector is referred to as the state of the system, and the components
of this vector are called state variables.
State Variables
The internal state variables are the smallest possible subset o f system variables that can represent the entire
state of the system at any given time. The minimum number of state variables required to represent a given
system, n, is usually equal to the order of the system’s defining differential equation. If the syst em is
represented in transfer function form, the minimum number of state variables is equal to the order of the
transfer function’s denominator after it has been reduced to a proper fraction. It is important to understand
that converting a state space real ization to a transfer function form may lose some internal information
about the system, and may provide a description of a system which is stable, when the state -space
realization is unstable at certain points. In electric circuits, the number of state va riables is often, though
not always, the same as the number of energy storage elements in the circuit such as
capacitors and inductors. The state variables defined must be linearly independent; no state variable can be
written as a linear combination of th e other state variables or the system will not be able to be solved.
PROGRAM:
3
clc;
clear;
close;
num=poly([10,7,3],'s','coeff');
den = poly([100,140,25,15,2],'s','coeff');
tf= num/den;
ss= tf2ss(tf);
disp(ss);
OUTPUT:
4
EXPERIMENT – 2
AIM: For the given transfer model, obtain state space and also determine observability and
controllability.
2 +2s +5s²
----------------
1 +6s +11s² +4s³
THEORY:
Observability , in control theory, is a measure for how well internal states of a system can be
inferred by knowledge of its external outputs. The observability was introduced by American-
Hungarian scientist Rudolf E. Kalman for linear dynamic systems.
Formally, a system is said to be observable if, for any possible sequence of state and control
vectors, the current state can be determined in finite time using only the outputs (this definition is
slanted towards the state space representation). Less formally, this means that from the systems
outputs it is possible to determine the behaviour of the entire system. If a system is not observable,
this means the current values of some of its states cannot be determined through
output sensors: this implies that their value is unknown to the
controller and, consequently, that it will be unable to fulfil the control specifications referred to
these outputs. For time -invariant systems in the state space representation, a convenient test to
check if a system is observable exist s. Consider a SISO system with state, if the row rank of the
following observability matrix is equal to n, then the system is observable. The rationale for
this test is that if n rows are linearly
independent, then each of the n states viewable through lin ear combinations of the output.
variables y(k)
A module designed to estimate the state of a system from measurements of the outputs is called a
state observer or simply an observer for that system.
Observability Index
The Observability index of a linear time -invariant discrete system is the smallest natural
5
number for which is satisfied that were
Controllability
Controllability is an important property of a control system , and the controllability property plays a crucial
role in many control problems, such as stabi lization of unstable systems
by feedback, or optimal control. Controllability and observability are dual aspects of the same
problem.
Roughly, the concept of controllability denotes the ability to move a system around in its entire
configuration space usi ng only certain admissible manipulations. The exact definition varies
slightly within the framework or the type of models applied.
The following are examples of variations of controllability notions which have been introduced
in the systems and control lit erature:
State controllability
Output controllability
Controllability in the behavioural framework
State Controllability
The state of a system, which is a collection of the system’s variable values, completely describes
the system at any given time. In particular, no information on the part of a system will help in
predicting the future, if the states at the present time are known.
Complete state controllability (or simply controllability if no other context is given) describes the
ability of an external input to move the internal state of system from any initial state to any other
final state in a finite time interval.
6
PROGRAM:
clc;
clear ;
close ;
num = 2*%s^2 + 2*%s + 5;
den = 1*%s^3 +6*%s^2 +11*%s +4;
sl =tf2ss(num/den);
[A,B,C,D] = abcd(sl);
Con = cont_mat(A, B)
Obs = obsv_mat(A, C)
rank_of_con = rank(Con)
rank_of_obs = rank(Obs)
col = A(: , 1);
system_order = length(col);
disp('A =');
disp(A);
disp('B =');
disp(B);
disp('C =');
disp(C);
disp('D =');
disp(D);
disp('Con =');
disp(Con);
disp('Obs');
disp(Obs);
disp('rank_of_con =');
disp(rank_of_con);
disp('rank_of_obs =');
disp(rank_of_obs);
disp('system_order =');
disp(system_order);
if rank(Con) ==rank(A)
disp('System is controllable')
else
disp('System is NOT controllable' )
end
if rank(Obs) == rank(A)
disp('System is observable')
else
disp('System is NOT observable')
end
OUTPUT:
7
8
EXPERIMENT- 3
−3 1 1 0 1
ẋ = [−1 0 1] x + [ 0 0]u
0 0 1 2 1
y = [0 0 1]
1 1 0
THEORY:
SISO is an acronym for single -input and single-output system. In control engineering it usually
refers to a simple single variable control system with one input and one output. In radio it is the
use of only one antenna both in the transmitter and receiver.
SISO systems are typically less comple x than multiple -input multiple -output (MIMO) systems.
Usually, it is also easier to make order of magnitude or trending predictions "on the fly" or "back of
the envelope". MIMO systems have too many interactions for most of us to trace through them
quickly , thoroughly, and effectively in our heads.
Frequency domain techniques for analysis and controller design dominate SISO control system
theory. Bode, Nyquist, Nichols, and root locus are the usual tools for SISO system analysis.
Controllers can be designed through the polynomial design, root locus design methods to name
just 2 of the more popular. Often SISO controllers will be PI, PID, or lead-lag.
9
PROGRAM:
clc
clear;
close ;
A = [-3,1,1;-1,0,1; 0,0,1];
B = [0,1; 0,0; 2,1];
C = [0,0,1;1,1,0];
D = [0];
X= cont_mat(A,B) ;
rank_of_X = rank(X) ;
Y = obsv_mat(A,C) ;
rank_of_Y = rank(Y);
P=A(: ,1);
system_order = length(P);
disp(X);
disp(Y);
disp(system_order);
disp(rank_of_Y);
disp(rank_of_X);
if rank(X) == system_order
disp('System is controllable' );
else
disp('System is NOT controllable' );
end
if rank(Y) == system_order
disp('System isobservable');
else
disp('System is NOT observable');
end
10
OUTPUT:
11
EXPERIMENT- 4
AIM: Obtain the transfer function of the system defined by the following state space equations.
x1 −1 1 0 x1 0
x2 = [ 0 −1 0 ] [x2] + [4] u
x3 = 0 0 −2 x3 0
x1
y = [1 1 1] [x2]
x3
Find transfer function , pole zeros, step, impulse & ramp response, bode and nyquist diagram.
THEORY:
In signal processing, the impulse response, or impulse response function (IRF) , of a dynamic
system is its output when presented with a brief input signal, called an impulse. More generally,
an impulse response refers to the reaction of any dynamic system in response to some external
change. In both cases, the impulse response describes the reaction of the system as a function of
time (or possibly as a function of some other independent variable that parameterizes the dynamic
behavior of the system).
For example, the dynamic system might be a planetary system in orbit around a star; the external
influence in this case might be another massive object ar riving from elsewhere in the galaxy; the
impulse response is the change in the motion of the planetary system caused by interaction with the
new object.
In all these cases, the 'dynamic system' and its 'impulse response' may refer to actual physical
object s, or to a mathematical system of equations describing these objects.
The step response of a system in a given initial state consists of the time evolution of its outputs
when its control inputs are Heaviside step functions. In electronic engineering
and control theory, step response is the time behavior of the outputs of a general system when its
inputs change from zero to one in a very short time. The concept can be extended to the abstract
mathematical notion of a dynamical system using an evolution.
From a practical standpoint, knowing how the system responds to a sudden input is important
because large and possibly fast deviations from the long term steady state may have extreme
12
effects on the component itself and on other portions of the overall system dependent on this
component. In addition, the overall system cannot act until the component's output settles down
to some vicinity of its final state, delaying the overall system response. Formally, knowing the
step response of a dynamical system gives information on the stability of such a system, and on
its ability to reach one stationary state when starting from another.
PROGRAM
// Create the state-space matrices
A = [-1,1,0;0,-1,0;0,0,-2];
B = [0;4;0];
C = [1,1,1];
D = [0];
sys = ss2tf(A,B,C,D);
figure;
step(sys);
impulseresponse(sys);
figure;
bode(sys);
margin(sys);
figure;
nyquist(sys);
13
OUTPUT:
14
15
EXPERIMENT- 5
AIM: Find the state space model, bode plot, nyquist plot and root locus of the following.
THEORY:
In electrical engineering and control theory , a Bode plot is a graph of the frequency response of a
system. It is usually a combination of a Bode magnitude plot, expressing the magnitude (usually in
decibels) of the frequency response, and a Bode phase plot, expressing the phase shift. Both
quantities are plotted against a horizontal axis proportional to the logarithm of frequency. Given
that the decibel is itself a logarithmic scale, the Bode amplitude plot is log– log plot, whereas the
Bode phase plot is a lin- log plot.
A Nyquist plot is a parametric plot of a frequency response used in automatic control and signal
processing. The most common use of Nyquist plots is for ass essing the stability of a system with
feedback. In Cartesian coordinates , the real part of the transfer function is plotted on the X axis.
The imaginary part is plotted on the Y axis. The frequency is swept as a parameter, resulting in a
plot per frequency. Alt ernatively, in polar coordinates , the gain of the transfer function is plotted
as the radial coordinate, while the phase of the transfer function is plotted as the angular
coordinate. The Nyquist plot is named after Harry Nyquist , a former engineer at Bell Laboratories
.
In control theory and stability theory , root locus analysis is a graphical method for examining
how the roots of a system change with variation of a certain system parameter, commonly a gain
within a feedback system. This is a technique used as a stability criterion in the field of control
systems developed by Walter R. Evans which can determine stability of the system. The root locus
plots the poles of the closed loop transfer function in the complex S plane as a function of a gain
parameter.
16
PROGRAM:
clc; clear ;
close;
disp('A =');
disp(A);
disp('B =');
disp(B);
disp('C =');
disp(C);
disp('D =');
disp(D);
disp(tf);
// Time domain analysis
evans(tf);
17
OUTPUT:
18
EXPERIMENT – 6
AIM: Find gain margin, phase margin, phase crossover frequency, gain crossover frequency,
using bode plot.
s2 + 2 s + 1 1
s 3 + 4 s2 + 3 s + 1 s+ 3
THEORY:
Pole–Zero Plot
In mathematics, signal processing and control theory , a pole–zero plot is a graphical
representation of a rational transfer function in the complex plane which helps to convey certain
properties of the system such as:
Stability
Causal system / anti-causal system
Region of convergence (ROC)
Minimum phase / non minimum phase
In general, a rational transfer function for a discrete LTI system has the form:
Where
Bode plot
In electrical engineering and control theory , a Bode plot is a graph of the frequency response of a
system. It is usually a combination of a Bode magnitude plot, expressing the magnitude (usually
in decibels) of the frequency response, and a Bode phase plot, expressing the phase shift. Both
quantities are plotted against a horizontal axis proportional to the logarithm of frequency. Given
that the decibel is itself a logarithmic scale, the Bode amplitude plot is log– log plot, whereas the
Bode phase plot is a line- log plot.
19
PROGRAM :
clc; clear ; close ;
subplot(6, 1, 1);
step(xs);
title('Step Response');
subplot(6, 1, 2);
impulse(xs);
title('Impulse Response');
subplot(6, 1, 3);
step(x3 * xs);
title('Ramp Response');
subplot(6, 1, 4);
nyquist(xs);
title('Nyquist Plot');
subplot(6, 1, 5);
pzmap(xs);
title('Pole-Zero Map');
subplot(6, 1, 6);
bode(xs);
margin(xs);
title('Bode Plot and Margin');
20
OUTPUT:
21
22
EXPERIMENT- 7
AIM: Find the transfer function, impulse response, step response, ramp response, pole zero map,
bode plot and nyquist plot of following diagrams using MATLAB.
2s + 4
s2 + 2
2s + 1 s+1
3s + 2 s+2
2s + 9
s + 4 s2 + 3s + 1
3
3s + 2
s2 + 2s + 1
s + 10
5s + 2
THEORY:
In mathematics, signal processing and control theory , a pole–zero plot is a graphical
representation of a rational transfer function in the complex plane which helps to convey certain
properti es of the system such as:
Stability
Causal system / anticausal system
Region of convergence (ROC)
Minimum phase / non minimum phase
In general, a rational transfer function for a discrete LTI system has the form:
Where
Bode plot
In electrical engineering and control theory , a Bode plot is a graph of the frequency response of a
system. It is usually a combination of a Bode magnitude plot, expressing the magnitude (usually
in decibels) of the frequency response, and a Bode phase plot, expressing the phase shift. Both
quantities are plotted against a horizontal axis proportional to the logarithm of frequency. Given
that the decibel is itself a logarithmic scale, the Bode amplitude plot is log– log plot, whereas the
Bode phase plot is a line- log plot.
PROGRAM:
clc; clear all; close all;
x7 = parallel(x3, x4);
x8 = feedback(x5, x6);
x9 = series(x1, x2);
display(x11);
subplot(6, 1, 1);
step(x11);
title('Step Response');
subplot(6, 1, 2);
impulse(x11);
24
title('Impulse Response');
t = 0:0.01:10;
subplot(6, 1, 3);
plot(t, ramp_response);
title('Ramp Response');
subplot(6, 1, 4);
bode(x11);
OUTPUT:
Finaltransferfunctionis:
x11 =
20 s^8 + 200 s^7 + 939 s^6 + 3006 s^5 + 6302 s^4 + 9513 s^3 + 9084 s^2 + 4462 s + 836
---------------------------------------------------------------------------------------
15 s^8 + 220 s^7 + 1202 s^6 + 3618 s^5 + 7349 s^4 + 9846 s^3 + 8906 s^2 + 4712 s + 1032
x12 =
20 s^8 + 200 s^7 + 939 s^6 + 3006 s^5 + 6302 s^4 + 9513 s^3 + 9084 s^2 + 4462 s + 836
-------------------------------------------------------------------------------------------
15 s^9 + 220 s^8 + 1202 s^7 + 3618 s^6 + 7349 s^5 + 9846 s^4 + 8906 s^3 + 4712 s^2 + 1032 s
>>
25
EXPERIMENT- 8
AIM: Calculate following fuzzy sets:
A union B, A intersection B, complement A, complement B where
THEORY:
Fuzzy Logic
As an extension of the case of multi-valued logic, valuations of propositional variables into a
set of membership degrees can be thought of as membership functions mapping predicates into
fuzzy sets (or more formally, into an ordered set of fuzzy pairs, called a fuzzy relation . With
these valuations, many -valued logic can be extended to allow for fuzzy premises from
which graded conclusions may be drawn.
This extension is sometimes called "fuzzy logic in the narrow sense" as opposed to "fuzzy
logic in the wider sense," which originated in the engineering fields of automated control and
knowledge en gineering, and which encompasses many topics involving fuzzy sets and
"approximated reasoning."
Industrial applications of fuzzy sets in the context of "fuzzy logic in the wider sense" can be
found at fuzzy logic.
Fuzzy sets
Fuzzy sets are sets whose el ements have degrees of membership. Fuzzy sets were introduced
simultaneously by Lotfi A. Zadeh and Dieter Klaua in 1965 as an extension of the classical
notion of set. In classical set theory, the membership of elements in a set is assessed in binary
terms according to a bivalent condition — an element either belongs or does not belong to the
set. By contrast, fuzzy set theory permits the gradual assessment of the membership of
elements in a set; this is described with the aid of a membership function value d in the real
unit interval [0, 1]. Fuzzy sets generalize classical sets, since the indicator functions of
classical sets are special cases of the membership functions of fuzzy sets, if the latter only take
values 0 or 1. In fuzzy set theory, classical biv alent sets are usually called crisp sets. The fuzzy
set theory can be used in a wide range of domains in which information is incomplete or
imprecise, such as bioinformatics.
26
PROGRAM:
clc;
clear;
close;
for i = 1:4
union(i) = max(A(i), B(i));
intersection(i) = min(A(i), B(i));
complement_A(i) = 1 - A(i);
complement_B(i) = 1 - B(i);
end
27
OUTPUT:
28
EXPERIMENT- 9
AIM: Draw 2D and 3D plot of unit step response curve for standard second order system
with ωn=1, ξ=0, 0.2, 0.4, 0.6, 0.8, 1.
t = 0:0.01:10;
u = ones(1,length(t));
y = zeros(length(zeta),length(t));
for i = 1:length(zeta)
num = poly ([1 1],'s','coeff');
den = poly ([1 2 1],'s','coeff');
H = syslin ('c',num,den);
y(i,:) = csim(u,t,H);
end
figure(1)
plot(t,y)
xlabel('Time (s)')
ylabel('Output (dimensionless)')
title('2D Step Response Curves for Standard Second Order System')
legend(string(zeta))
grid on;
figure(2)
surf(t,zeta,y)
xlabel('Time (s)')
ylabel('Damping Ratio (dimensionless)')
zlabel('Output (dimensionless)')
title('3D Step Response Surface for Standard Second Order System')
grid on
29
30
31