Documente Academic
Documente Profesional
Documente Cultură
Sources on MATLAB
Some of useful resources available function library MATLAB programming
especially related to control engineering are given in
(i)
(ii)
www.mathsworks.com
MATLAB Programming for Engineers by Stephen J Chapman, Thomson
Books, Singapore, 2002
(iii)
()
()
(1)
Where N(s) is the numerator polynomial and D(s) is the denominator polynomial
in Laplace variable s.
Let () = + 1 1 + + 0
() = + 1 1 + + 0
The coefficient of the numerator and denominator polynomials are needed to build
G(s). The MATLAB command used for this purpose is tf
= ([ 1 0 ], [ 1 0 ])
This will store the transfer function given by equation (1) in the variable g
Connection of Blocks
Two blocks could be connected in series, parallel or in feedback mode. Although
MATLAB supports the building of multiple interconnections between the blocks.
We shall learn here two simple commands named series and parallel. If g1 and
g2 are there two transfer function in series we can write
1 ()
2 ()
2 = (1 (), 2 ())
=( 1 , 2 )
B
+
2
Then the corresponding command to express this relationship is
2 = (1 , 2 )
Another very important mode commonly used in controls is feedback. The
standard block diagram with g as forward transfer function and h as feedback
transfer function with negative feedback.
A r
2 =
1 +
This can be represented in MATALAB by using the feedback command. Thus for
figure 3,
a2b=feedback(g1h).
Once we have learnt these four basic operations to develop the control the transfer
function we shall try to solve some examples.
Let a transfer function between two point A and B be given as
1
2 + 3
2 = ([1], [2 3])
3
5 + 6
2
3 2
1 = ([3], [5 6])
2 = ([2], [3 2])
2 = (1, 2)
2
+ 2 + 4)
B
+
1+
3
(2 2
1
+ 3 + 4)
1
1+
100
1+
a2b=
100
+201
when this system is subjected to a step input the response can be plotted by the
command
7
step (a2b)
The reponse figure as shown below is generated by MATLAB.
Step Response
0.5
Amplitude
0.4
0.3
0.2
0.1
0
0
0.005
0.01
0.015 0.02
Time (sec)
0.025
0.03
Also note that by putting the grid on modifier the graph can be plotted with the
grid display. The range of this graph is automatically decided by the MATLAB.
However user can specify her own time interval or discrete time steps at which the
response would be plotted. Then command modifies to
step(a2b,t)
Where t could either be a number representing Tfinal ( plot will be generated from
0 to Tfinal) or it could also be a vector of equi-spaced time interval
eg. step(a2b,.02)
or t=0.1;0.01;0.4;
step(a2b,t) gives the plot as
8
shown
Step Response
0.4975
0.4975
Amplitude
0.4975
0.4975
0.4975
0.4975
0.4975
0.1
0.15
0.2
0.25
Time (sec)
0.3
0.35
one of the important response plots of the system is its response to initial condition.
For an nth order system (degree of highest power of s occurring in the transfer
function ) n initial conditions are required, which are specified in the vector
form. The general command syntax used is
initial(sys, x0)
where x0 is the value of
,
at t=0
()
()
= a2b =
1
( 2 +0.1+10)
=1
9
= 0, = 1
A2bs=ss(A,[ ],C,[ ])
a2bs is the system description in state space and then use the command function
initial response after defining the initial condition
1
{x0}={ } = [1 1]
1
Initial (a2bs, x0) will give the response
We shall also explore the response of the system (defined by the transfer function
or state- space) to an arbitrary input.
We define an input is as shown as
10
11
u=0.5t 0<t<10
u=5 t>10 we shall create two array u and t of the same dimension so that for any
time t the corresponding value of forcing function u is at the same location
(index n.)
let t=0: 0.1:20;
this will generate 200 points from 0 to 200sec at an interval of 0.1. The response
of the system to this arbitrary input is generated by
lsim (a2b,u,t,x0)
12