Sunteți pe pagina 1din 25

CONTROL SYSTEMS

LABORATORY PRACTICAL FILE


(MATLAB Experiments)

Agam Singh
03913204914
EEE
(2015-2016)

EXPERIMENT -5

AIM:- Introduction to MATLAB.


MATLAB (matrix laboratory) is a multi-paradigm numerical
computing environment and fourth-generation programming language.
A proprietary programming language developed by MathWorks, MATLAB
allows matrix manipulations, plotting of functions and data,
implementation of algorithms, creation of user interfaces, and interfacing
with programs written in other languages, including C, C+
+, Java, Fortran and Python.
MATLAB is widely used in all areas of applied mathematics, in education
and research at universities, and in the industry. This makes the software
particularly useful for linear algebra but MATLAB is also a great tool for
solving algebraic and differential equations and for numerical integration.
MATLAB has powerful graphic tools. It is also a programming language,
and is one of the easiest programming languages for writing mathematical
programs. MATLAB also has some tool boxes useful for signal processing,
image processing, optimization, etc.
There are many toolboxes available in MATLAB and one of them is
CONTROL SYSTEM TOOLBOX.

CONTROL SYSTEM TOOLBOX:


Control System Toolbox provides industry-standard algorithm for
systematically analyzing, designing, and tuning linear control systems. We
can specify our system as a transfer function, state-space, zero-pole-gain
or frequency-response model. Applications and functions, such as step
response plot and Bode plot, let us visualize system behaviour in time
domain and frequency domain. We can tune compensator parameters
using automatic PID controller tuning, Bode loop shaping, root locus
method, LQR/LQG design, and other interactive and automated
techniques. We can validate your design by verifying rise time, overshoot,
settling time, gain and phase margins, and other requirements.
Key Features:
1. Transfer-function, state-space,
zero-pole-gain
and
frequencyresponse models of linear systems
2. Series, parallel, feedback, and general block-diagram connection of
linear models
3. Step response, Nyquist plot, and other time-domain and frequencydomain tools for analyzing stability and performance measures
4. Root locus, Bode diagrams, LQR, LQG, and other classical and statespace control system design techniques

5. Automatic tuning of PID controllers


6. Model
representation
conversion,
continuous-time
model
discretization, and low-order approximation of high-order systems
Control System Toolbox provides commands for:
Performing arithmetic on linear models
2. Building complex block diagrams by connecting simple models in
series, parallel, or feedback
3. Discretizing continuous-time models
4. Computing low-order approximations of high-order models
Some useful commands in control system toolbox are:
1.

1. bodeplot: plot Bode frequency response and return plot handle


2. feedback: feedback connection of two LTI models
3. impulse: impulse response of LTI model
4. initial: initial condition response of state space model
5. pole: compute poles of LTI system
6. real: real part of frequency response of LTI system
7. step: step response of LTI system
8. tf: create of convert to transfer function model
9. zero: transmission zeroes of LTI system
10.
unsample: unsample discrete time LTI system
11.
pzmap: compute pole-zero map of LTI models
12.
tf2zp: convert transfer function filter parameters to zero-polegain form
13.
zp2tf: convert zero-pole-gain filter parameters to transfer
function form
14.
total delay: total combined input delay for LTI system
15.
nyquistplot: plot Nyquist frequency responses and return plot
handle

ADVANTAGES OF MATLAB:
1. A very large database of built-in algorithms for image processing
and computer vision applications
2. MATLAB allows you to test algorithms immediately without
recompilation. You can type something at the command line or
execute a section in the editor and immediately see the results,
greatly facilitating algorithm development.
3. The MATLAB Desktop environment, which allows you to work
interactively with your data, helps you to keep track of files and
variables, and simplifies common programming/debugging tasks
4. The ability to read in a wide variety of both common and domainspecific image formats.
5. Clearly written documentation with many examples, as well as
online resources such as web seminars ("webinars").

6. Bi-annual updates with new algorithms, features, and performance


enhancements
7. If you are already using MATLAB for other purposes, such as
simulation, optimation, statistics, or data analysis, then there is a
very quick learning curve for using it in image processing.
8. The ability to process both still images and video.

DISADVANTAGES OF MATLAB:
1. Requires excellent programming skills
2. Takes long time to develop and test
3. The debugging process takes time as the source code is interpreted
rather than compilation
4. The program is usually written for a dedicated simulation problem
5. It is necessary to get the mathematical model of simulated system
and this may be difficult to handle.
6. The source code is not available and hence it is not possible to
modify/upgrade the simulation package.

AIM: Program to perform different operations on


matrices
clc;
clear all;
close all;
a = [1,2,3;4,5,6;7,8,9]
b = [9,8,7;6,5,4;3,2,1]
c = a+b
d = a-b
e = a*b
f = eig(a)
g = transpose(a)
h = a.*b
OUTPUT:-

EXPERIMENT-2

AIM:
(a)Given a transfer function, compute its representation in zero
and pole form along with its pole zero plot.
(b)Also a system being represented by its zeroes, poles and
gain k, find its transfer function.
clc;
close all;
clear all;
% PART A
n = [1];
d = [1 2 8 3 16];
g = tf(n,d)
[z,p,k] = tf2zp(n,d)
pzmap(g)
%PART B
fprintf('PART B:-')
z = [-3;-1]
p = [0;-1;-2;-3]
k=7
[num,den] = zp2tf(z,p,k)
g=tf(num,den)

OUTPUT:

PART A:-

PART B:-

EXPERIMENT 3
AIM:

Given a plant model with transfer function G1(s) = 11 / (s^2+5s+6)


and G2(s) = 7 / (s+9), using matlab commands obtain the transfer
function of the system when connected in
(a) cascade.
(b) parallel.
(c) feedback.

clc;
clear all;
close all;
n1 = [11];
d1 =[1 5 6];
g1 = tf(n1,d1)
n2 = [7];
d2 = [1 9];
g2 = tf(n2,d2)
fprintf(' Connected in cascade')
g3 = series(g1,g2)
fprintf(' connected in parallel')
g4 = parallel(g1,g2)
fprintf(' conected in feedback')
g5 = feedback(g1,g2)

EXPERIMENT-4

AIM:
Consider the following system defined by its transfer function
G(S)=16/(s^2+4s+16).
a)Obtain the unit step response curve using MATLAB.
b)Obtain the unit impulse reponse.
c)Obtain its unit ramp response.
d)What will be the time response for an arbitrary input r=t+2.
% expt 4(a)
% to plot unit step response
clc;

clear all;
close all;
num=[16];
den=[1 4 16];
g=tf(num,den)
step(g)
stepinfo(g)
grid on;
title('Step response plot for G(s) is:');

% expt 4(b)
% to plot impulse response
clc;
clear all;
close all;
num=[16];
den=[1 4 16];
g=tf(num,den)
impulse(g)
grid on;
title('Impulse response plotfor G(s) is:');

% expt 4(c)
% to plot ramp response
clc;
clear all;
close all;
num=[16];
den=[1 4 16];
sys=tf(num,den);
disp('The given response is:')
t=0:1:10
r=step(num,den,t);
plot(t,r,'*',t,t,'o');
grid on;
title('Unit ramp response is:');
xlabel('Time(sec)--------->');
ylabel('reference input curve and output curve');

% expt 4(d)
% to plot response for input r=t+2
clc;
clear all;
close all;
num=[16];
den=[1 4 16];
sys=tf(num,den)
disp('The given response is:')
t=0:0.1:10
r=2+t;
c=lsim(num,den,r,t);
plot(t,r,'*',t,c,'o');
grid on;
title('Response for specified input r=t+2 is:');
xlabel('Time(sec)--------->');
ylabel('Output c(t) and given input r(t)');

EXPERIMENT-5
AIM:
Consider the negative unity feedback control system with the
following feed forward transfer function g(S)=k/s(s^2+9s+20). Plot
the root loci in MATLAB. Find the closed loop poles that have the
damping ratio of 0.2. find the values of gain k at this point.
clc;
clear all;
close all;
% let k=1
num=[1];
den=[1 9 20 0];
rlocus(num,den)
title('Root locus plot');
xlabel('Real axis');
ylabel('imaginary axis');
sgrid(0.2,[])
[k,r]= rlocfind(num,den)
disp('Select a point in the Graphics window');

EXPERIMENT-6
AIM:
Find the number of roots in the right half plane of s-plane for
f(S)=s^4+6s^3+11s^2+11s+6 using MATLAB and thereby check the
system stability.

clc;
clear all;
close all;
poly=[1 6 11 11 6]
disp('The routh array formulated is')
dim=size(poly)
coe=dim(2)
rsc=sym(zeros(coe,ceil(coe/2)));
for i=1:coe
rsc(2-rem(i,2),ceil(i/2))= poly(i);
end
for i=3:coe
for j=1:2
rsc(i,j)= -det([rsc(i-2,1) rsc(i-2,j+1);
rsc(i-1,1) rsc(i-1,j+1)])/rsc(i-1,1)
end
end

EXPERIMENT-7
AIM:
Consider a system defined by G(S)=1/(s(0.7s+1)(s+1).Obtain the
bode frequency diagram.Obtain the resonant peak,resonant
frequency and bandwidth.
clc;
clear all;
close all;
num=[1];
den= conv([1,0], conv([0.7 1],[1 1]));
g=tf(num,den)
w1=logspace(-1,1);
bode(g,w1)
[magnitude,phase,w]=bode(g,w1);
[rp,k]=max(magnitude);
disp('Reasonant Peak');
RP= 20*log10(rp)
disp('Resonant Frequency');
RF=w(k)
bw=1;
while 20*log(magnitude(bw))>=-3;
bw=bw+1;
end
disp('Bandwidth');
BW=w(bw)

EXPERIMENT-8
AIM:
For the given transfer function G(S)=1/(s^2+2s+3); Draw the nyquist
plot using MATLAB functions.

clc;
clear all;
close all;
num=[1];
den=[1 2 3];
G=tf(num,den)
nyquist(G)
grid on;
title('The Nyquist plotfor G(s)=1/s^2+2s+3');

EXPERIMENT 9

AIM:
To study the time and frequency response of common RLC circuit.

S-ar putea să vă placă și