Control System Lab - Exp - 4-14
Control System Lab - Exp - 4-14
APPARATUS:
Software: MATLAB
THEORY:
An impulse signal is a signal whose value changes from zero to infinity in zero time.
Mathematically, the unit impulse signal is represented as given below:
where:
So,
MATLAB PROGRAM:
num = input(‘enter the numerator of the transfer function’)
11
den = input(‘enter the denominator of the transfer function’)
impulse(num,den)
EXAMPLE:
Obtain the impulse response of the transfer function given below:
PROCEDURE:
THEORETICAL CALCULATIONS:
12
GRAPH
13
TABULAR FORM:
T C(t)
0
RESULT:
APPARATUS:
Software: MATLAB
THEORY:
A ramp signal is a signal which changes with time gradually in a linear fashion. Mathematically,
the unit ramp signal is represented as given below:
So,
15
MATLAB PROGRAM:
lsim(num,den,u,t)
EXAMPLE:
Obtain the ramp response of the transfer function given below:
PROCEDURE:
THEORETICAL CALCULATIONS:
16
17
TABULAR FORM:
T C(t)
0
RESULT:
AIM:
To obtain the time response of a given second order system with its damping frequency.
18
APPARATUS:
Software: MATLAB
THEORY:
The time response has utmost importance for the design and analysis of control systems because
these are inherently time domain systems where time is independent variable. During the
analysis of response, the variation of output with respect to time can be studied and it is known
as time response. To obtain satisfactory performance of the system with respect to time must be
within the specified limits. From time response analysis and corresponding results, the stability
of system, accuracy of system and complete evaluation can be studied easily.
Due to the application of an excitation to a system, the response of the system is known as time
response and it is a function of time. The two parts of response of any system:
(i) Transient response
(ii) Steady-state response.
Transient response: The part of the time response which goes to zero after large interval of time
is known as transient response.
Steady state response: The part of response that means even after the transients have died out is
said to be steady state response.
The total response of a system is sum of transient response and steady state response:
C(t)=Ctr(t)+Css(t)
TF=
19
– is called damping factor or actual damping or damping coeeficient.
MATLAB PROGRAM:
wn=input('enter value of undamped natural frequency')
z=input('enter value of damping ratio')
n=[wn*wn]
p=sqrt(1-z^2)
wd=wn*p
h=[p/z]
k=atan(h)
m=pi-k;
tr=[m/wd]
tp=[pi/wd]
q=z*wn
ts=[h/q]
r=z*pi
f=[r/p]
mp=exp(-f)
num=[0 0 n]
den=[1 2*z*wn n]
s=tf(num,den)
hold on
step(s)
impulse(s)
hold off
20
PROCEDURE:
1.Time response of the system is being found when we give the values of natural undamped
frequency and damping ratio.
2.When we give these values first rise time ,peak time,peak overshoot,transfer function are being
calculated.
3.Then “ step(s)” And “impulse(s)” generates time response of the system.
5.The hold function determines whether new graphics object are added to the graph or replaces
objects in the graph.
6.hold on retains the current plot and certain axes properties so that subsequent graphing
command add to the existing graph.
7.hold off resets axes properties to their defaults before drawing new plots.hold off is the default.
THEORETICAL CALCULATIONS:
GRAPH:
21
RESULT:
22
7.TRANSFER FUNCTION OF A DC MOTOR
AIM:
THEORY:
The transfer function of a DC motor is studied ( in general)
23
PROCEDURE:
Type the program in the MATLAB editor that is in M-file.
Save and run the program.
Give the required inputs in the command window of MATLAB .
MATLAB PROGRAM:
J=0.01;
B=0.1;
K=0.01;
24
R=1;
L=0.5;
S=tf(‘s’);
P_motor=K/((J*s+B)*(Ls+R)+K^2);
zpk(P_motor);
THEORITICAL CALCULATIONS:
RESULT:
25
8.ROOT LOCUS FROM A TRANSFER FUNCTION
AIM:
To plot the root locus for a given transfer function of the system using MATLAB.
APPARATUS:
Software: MATLAB
THEORY:
rlocus computes the Evans root locus of a SISO open-loop model. The root locus gives the
closed-loop pole trajectories as a function of the feedback gain k (assuming negative feedback).
Root loci are used to study the effects of varying feedback gains on closed-loop pole locations.
In turn, these locations provide indirect information on the time and frequency responses.
rlocus(sys) calculates and plots the rootlocus of the open-loop SISO model sys. This function can
be applied to any of the following feedback loops by setting sys appropriately.
If sys has transfer function
h(s) =
MATLAB PROGRAM:
num=input(‘enter the numerator of the transfer function’)
den=input(‘enter the denominator of the transfer function’)
h=tf(num,den)
rlocus(h)
PROCEDURE:
[r,k] = rlocus(sys)
r = rlocus(sys,k)
rlocus(sys) calculates and plots the root locus of the open loop SISO model sys.
Now we have to solve it theoretically.
Now we have to compare the practical and theoretical ouputs to verify each other
correctly.
EXAMPLE:
Transfer function =
THEORETICAL CALCULATIONS:
num=
enter the denominator of the transfer function
den=
Transfer function :
27
RESULT:
28
9.BODE PLOT FROM A TRANSFER FUNCTION
AIM:
To obtain bode plot for a givan transfer function of the system using MATLAB.
APPARATUS:
Software: MATLAB
THEORY:
Bode computes the magnitude and phase of the frequency response of LTI models. When
invoked without left-side arguments, bode produces a Bode plot on the screen. The magnitude is
plotted in decibels (dB), and the phase in degrees. The decibel calculation for mag is computed
as 20log10(|H(jw)|), where H(jw) is the system's frequency response. Bode plots are used to
analyze system properties such as the gain margin, phase margin, DC gain, bandwidth,
disturbance rejection, and stability.
If we convert both sides to decibels, the logarithms from the decibel calculations convert
multiplication of the arguments into additions, and the divisions into subtractions:
n m
29
bode(sys) plots the Bode response of an arbitrary LTI model sys. This model can be continuous
or discrete, and SISO or MIMO. In the MIMO case, bode produces an array of Bode plots, each
plot showing the Bode response of one particular I/O channel. The frequency range is
determined automatically based on the system poles and zeros.
bode(sys,w) explicitly specifies the frequency range or frequency points to be used for the plot.
To focus on a particular frequency interval [wmin,wmax], set w = {wmin,wmax}. To use
particular frequency points, set w to the vector of desired frequencies. Use logspace to generate
logarithmically spaced frequency vectors. All frequencies should be specified in radians/sec.
return the magnitude and phase (in degrees) of the frequency response at the frequencies w (in
rad/sec). The outputs mag and phase are 3-D arrays with the frequency as the last dimension (see
"Arguments" below for details). You can convert the magnitude to decibels by
magdb = 20*log10(mag)
MATLAB PROGRAM:
num=input('enter the numerator of the transfer function')
30
PROCEDURE:
EXAMPLE:
Transfer function=
THEORETICAL CALCULATIONS:
enter the numerator of the transfer function
num =
Transfer function:
gm =
pm =
wcp =
wcg =
31
GRAPH
32
RESULT:
33
10.TRANSFER FUNCTION FROM STATE MODEL
AIM:
To obtain the transfer function from the state model.
APPARATUS:
Software: MATLAB
THEORY:
The transfer function is defined as the ratio of Laplace transform of output to
Laplace transform of input. The transfer function of a given state model is given by:
"State space" refers to the space whose axes are the state variables. The state of the system
can be represented as a vector within that space.
The input state equation is given by,
MATLAB PROGRAM:
A =input(‘enter the matrix A’)
34
B= input(‘enter the matrix B’)
C = input(‘enter the matrix C’)
EXAMPLE:
Obtain the transfer function from the State Model given below:
A=
B=
C=
D=
PROCEDURE:
35
THEORETICAL CALCULATIONS:
A=
B=
C=
D=
RESULT:
36
11.STATE MODEL FROM TRANSFER FUNCTION
AIM:
To obtain the state model from the given transfer function.
APPARATUS:
Software: MATLAB
THEORY:
There are three methods for obtaining state model from transfer function:
1. Phase variable method
Out of three methods given above canonical form is probably the most straightforward method
for converting from the transfer function of a system to a state space model is to generate a
model in "controllable canonical form." This term comes from Control Theory but its exact
meaning is not important to us. To see how this method of generating a state space model
works, consider the third order differential transfer function:
We start by multiplying by Z(s)/Z(s) and then solving for Y(s) and U(s) in terms of Z(s). We
also convert back to a differential equation.
We can now choose z and its first two derivatives as our state variables
37
Now we just need to form the output
From these results we can easily form the state space model:
In this case, the order of the numerator of the transfer function was less than that of the
denominator. If they are equal, the process is somewhat more complex. A result that
works in all cases is given below; the details are here. For a general nth order transfer
function:
MATLAB PROGRAM:
num=input(‘enter the numerator of the transfer function’)
den=input(‘enter the denominator of the transfer function’)
ss(tf(num,den))
38
EXAMPLE:
Obtain the state model from the transfer function given below:
PROCEDURE:
THEORETICAL CALCULATIONS
Enter the transfer function
39
A=
B=
C=
D=
RESULT:
40
12.STATE MODEL FROM ZEROS AND POLES
AIM:
To obtain a state model from given poles and zeros using MATLAB.
APPARATUS:
Software: MATLAB
THEORY:
Let’s say we have a transfer function defined as a ratio of two polynomials:
H(s)=
Where,
X = state vector
U = input vector
A = n x n matrix
B = n x 1 matrix
The output equation for the above system is,
41
MATLAB PROGRAM:
z=input('enter zeros')
p=input('enter poles')
k=input('enter gain')
[A,B,C,D]=zp2ss(z,p,k)
PROCEDURE:
EXAMPLE:
zeros are:
poles are:
gain=
42
THEORETICAL CALCULATIONS:
Given,zeros =
Given, poles=
X(s)=
X(t)=
Let ;
Y(s)=
Y(t)=
Therefore,
A=
B=
43
C=
D=
RESULT:
Theoretical Result:
Practical Result:
44
13.ZEROS AND POLES FROM STATE MODEL
AIM:
To obtain poles and zeros from a given state model using MATLAB
APPARATUS:
Software: MATLAB
THEORY:
Let’s say we have a transfer function defined as a ratio of two polynomials:
H(s)=
Where,
X = state vector
U = input vector
A = n x n matrix
B = n x 1 matrix
The output equation for the above system is,
45
MATLAB PROGRAM:
A=input('enter matrix A')
[z,p,k]=ss2zp(A,B,C,D)
EXAMPLE:
A=
B=
C=
D=
PROCEDURE:
46
Note down the output zeros, poles and gain obtained practically by using the syntax
“[z,p,k]=ss2zp(A,B,C,D)”.
Now find the poles, zeros and gain theoretically for the given state model
Compare the theoretically obtained poles, zeros and gain from the given state model with
the one obtained practically. Write the result based on the comparison between
theoretical and practical result.
THEORETICAL CALCULATIONS:
RESULT:
Practical Result:
Theoretical Result:
47
14. STEP RESPONSE OF A STATE MODEL
AIM:
To find the step response of a state model for a given system using MATLAB.
APPARATUS:
Software: MATLAB
THEORY:
A step signal is a signal whose value changes from one level to another level in zero time.
Mathematically, the step signal is represented as given below:
where
So,
48
MATLAB PROGRAM:
A=input(‘enter matrix A’)
B=input(‘enter matrix B’)
C=input(‘enter matrix C’)
D=input(‘enter matrix D’)
Step(A,B,C,D)
EXAMPLE:
Obtain the step response of the state model for the given system.
T.F.=
PROCEDURE:
Step calculates the unit step response of a linear system. Zero initial state is assumed in
the state-space case.
When invoked with no output arguments, this function plots the step response on the
screen.
Step(sys) plots the step response of an arbitrary LTI model sys. This model can be
continuous or discrete, and SISO or MIMO.
The duration of simulation is determined automatically based on the system poles and
zeros.
You can specify either a final time t = Tfinal (in seconds), or a vector of evenly spaced
time samples of the form
t = 0:dt:Tfinal
For discrete systems, the spacing dt should match the sample period. For continuous
systems, dt becomes the sample time of the discretized simulation model (see
"Algorithm"), so make sure to choose dt small enough to capture transient phenomena.
To plot the step responses of several LTI models sys1,..., sysN on a single figure, use
step(sys1,sys2,...,sysN)
49
step(sys1,sys2,...,sysN,t)All systems must have the same number of inputs and outputs but may
otherwise be a mix of continuous- and discrete-time systems.
GRAPH:
50
THEORETICAL CALCULATIONS
RESULT:
51