lab_1
lab_1
Experiment 01:
Introduction to Control Engineering Commands
Control System:
A control system is an interconnection of components forming a system configuration that will provide
a desired system response. Hence, a control system is an arrangement of physical components
connected or related in such a manner as to command, regulate, direct, or govern itself or another
system. A control system provides an output or response for a given input or stimulus.
There are three basic forms to describe linear time-invariant (LTI) systems in MATLAB
Zero-pole-gain form:
1) Transfer Function:
H=tf(num, den)
H=zpk([], [-1, -2], 2)
2) RESIDUE: Partial-fraction expansion:
[R,P,K] = RESIDUE(B, A)
finds the residues, poles and direct term of a partial fraction expansion of the ratio of two polynomials
B(s)/A(s). If there are no multiple roots,
B(s) R(1) R(2) R(n)
---- = -------- + -------- + ... + -------- + K(s)
A(s) s - P(1) s - P(2) s - P(n)
Vectors B and A specify the coefficients of the numerator and denominator polynomials in descending
powers of s. The residues are returned in the column vector R, the pole locations in column vector P,
and the direct terms in row vector K.
SYS1 and SYS2 in series such that the outputs of SYS1 specified by OUTPUTS1 are connected to the
inputs of SYS2 specified by INPUTS2.
SYS = FEEDBACK(SYS1, SYS2) computes an LTI model SYS for the closed-loop feedback system.
To apply positive feedback, use the syntax
from a single input. Vector DEN must contain the coefficients of the denominator in descending
powers of s. Matrix NUM must contain the numerator coefficients. The A, B, C, D matrices are
returned in controller canonical form. This calculation also works for discrete systems.
Program # 1:
disp(‘………..’)
disp(‘Created by xxxx’)
disp(‘Reg#’)
num=[2 5 3 6]
den=[1 6 11 6]
[r,p,k]=residue(num,den)
[num,den]=residue(r,p,k)
printsys(num,den,'S')
Output :-
Program # 2:
m = 2;
b = 5;
k = 3;
num = [ 1 ];
den = [ m b k ];
tutorial_tf = tf(num, den)
Output:
Program # 3:
num=[2 5 3 6]
den=[1 6 11 6]
[z,p,k]=tf2zp(num,den)
disp('Zeros of the function is = ')
disp(z)
disp('Poles of the function is = ')
disp(p)
disp('Gain of the function is = ')
disp(k)
Output:-
Program # 4:
num1=[10]
den1=[1 2 10]
num2=[5]
den2=[1 5]
[num,den]=series(num1,den1,num2,den2)
printsys(num,den,'S')
Output
Program # 5:
num1=[10]
den1=[1 2 10]
num2=[5]
den2=[1 5]
[num,den]=parallel(num1,den1,num2,den2)
printsys(num,den,'S')
Output:-
Program # 6:
num1=[10 20 30 41 78 ]
den1=[1 2 10 47 58 41]
num2=[5 47 1 2 89 ]
den2=[1 5 41]
[num,den]=feedback(num1,den1,num2,den2)
printsys(num,den,'S')
Output:-
Program # 7:
num=[2 1 1 2]
den=[1 4 8 2]
[a,b,c,d]=tf2ss(num,den)
printsys(num,den,'S')
Output:-
Program# 8:
Once the transfer function is entered into MATLAB it is easy to calculate the response to a step
input. To calculate the response to a unit step input, use
step(transfer function)
where transfer function is the name of the transfer function of the system.
For steps with magnitude other than one, calculate the step response using:
where u is the magnitude of the step and transfer function is the name of the transfer function of the
system.
MATLAB can also plot the impulse response of a transfer function. Because the transfer function is
in the form of output over input, the transfer function must be multiplied by the magnitude of the
impulse. The syntax for plotting the impulse response is:
where u is the magnitude of the impulse and transfer function is the name of the transfer function of
the system.
MATLAB’s bode command plots the frequency response of a system as a bode plot. The syntax for
the bode plot function in MATLAB is:
bode(transfer function)
rlocus(transfer function)