Pages

Sunday, July 20, 2014

Matlab

Block Diagram Reduction

TITLE:
Block Diagram Reduction
1.  OBJECTIVE:-
The objective of this exercise will be to learn commands in MATLAB that would be used to reduce linear systems block diagram using series, parallel and feedback configuration.
2.     List of Equipment/Software
·         Following equipment/software is required:
·         MATLAB

3.   THEORY:-
MatLab's Control Toolbox provides a number of very useful tools for manipulating block diagrams of linear systems. There are three basic configurations that you will run into in typical block diagrams. These are the parallel, series, and feedback configurations. While it is important to feel comfortable calculating the overall transfer function given a complicated block diagram by hand, Matlab is a very useful tool for removing some of the drudgery from this task. In this studio, we will talk about MatLab's functions for automated block diagram manipulation, and also look at how Matlab can be used to manually manipulate block diagrams. Using these tools, we will investigate some important properties of feedback systems such as tracking and steady-state error.

4.  Key Commands:
        parallel
               series
               feedback

Parallel:
When different systems are in parallel configuration then to calculate the transfer function of the whole system in MATLAB, built in command “parallel” is used.
The syntax is  
sys=parallel(sys1,sys2)
Series:
When different systems are in seriesconfiguration then to calculate the transfer function of the whole system in MATLAB, built in command “series” is used.
The syntax is   
sys=series(sys1,sys2)

Feedback:
When feedback is involve in system then to calculate the transfer function of the whole system in MATLAB, built in command “feedback” is used.
The syntax is  
sys=feedback(sys1,sys2,sign)

Series Blocks:
A series connection of transfer functions yields an overall transfer function of T(s) = G1(s) G2(s). The matlab function series() can be used to determine this transfer function. Using the example systems,
Assume two transfer functions,   , and  
If G1(s) =sys1 and G2(s) =sys2
Using the example systems, find the series connection by typing:
sys=series(sys1,sys2)
Example :01
MATLAB code:
clc
clear all;
close all;
num1=[1 0];
denum1=[1 0 2];
sys1=tf(num1,denum1)
num2=[1];
denum2=[3 1];
sys2=tf(num2,denum2)
sys=series(sys1,sys2)

Output:

Transfer function:
   s
-------
s^2 + 2

Transfer function:
   1
-------
3 s + 1

Transfer function:
          s
---------------------
3 s^3 + s^2 + 6 s + 2





Parallel Blocks:
Consider a diagram with two blocks in parallel, as shown here:
The overall transfer function, C(s)/R(s), is given by T(s) = G1(s) + G2(s). The MatLab function parallel() can be used to determine the overall transfer function of this system. To see how this works, type:
sys=parallel(sys1,sys2)

Example :02

MATLAB code:
clc
clear all;
close all;
num1=[1 0];
denum1=[1 0 2];
sys1=tf(num1,denum1)
num2=[1];
denum2=[3 1];
sys2=tf(num2,denum2)
sys=parallel(sys1,sys2)

Output:
Transfer function:
   s
-------
s^2 + 2

Transfer function:
   1
-------
3 s + 1

Transfer function:
    4 s^2 + s + 2
---------------------
3 s^3 + s^2 + 6 s + 2

Feedback Blocks:

Feedback connections are what the topic of control systems is all about. You should already know that for the following negative feedback connection, the
resulting transfer function is given by   . Rather than simplifying this by hand, T(s) can be found using MatLab's feedback() function.
Example :03
Feedback withnon-unity loop gain
MATLAB code:
clc
clear all;
close all;
num1=[1 0];
denum1=[1 0 2];
sys1=tf(num1,denum1)
num2=[1];
denum2=[3 1];
sys2=tf(num2,denum2)
sys=feedback(sys1,sys2,-1)
Output:
Transfer function:
   s
-------
s^2 + 2

Transfer function:
   1
-------
3 s + 1

Transfer function:
      3 s^2 + s
---------------------
3 s^3 + s^2 + 7 s + 2








Example :04
Feedback with unity loop gain
MATLAB code:
clc
clear all;
close all;
num1=[1 1];
denum1=[1 2];
sys1=tf(num1,denum1);
num2=[1];
denum2=[500 0 0];
sys2=tf(num2,denum2);
sys3=series(sys1,sys2);
sys=feedback(sys3,[1],-1)

Output:
Transfer function:
          s + 1
--------------------------
500 s^3 + 1000 s^2 + s + 1
Poles and zeros of system
MATLAB code:
Clc;clear all;close all;
num1=[6 4 3];
denum1=[2 1 3 1];
sys1=tf(num1,denum1)
z=zero(sys1)
p=pole(sys1)
num2=[3 2]; num3=[5 1];
denum2=[2 4];denum3=[4 -5];denum4=[3 -6];
num5=conv(num2,num3);
denum5=conv(denum2,conv(denum3,denum4));
sys2=tf(num5,denum5)
pzmap(sys2)

Output:
Transfer function:
   6 s^2 + 4 s + 3
---------------------
2 s^3 + s^2 + 3 s + 1
z =
  -0.3333 + 0.6236i
  -0.3333 - 0.6236i
p =
  -0.0772 + 1.2003i
  -0.0772 - 1.2003i
  -0.3456         
Transfer function:
     15 s^2 + 13 s + 2
----------------------------
24 s^3 - 30 s^2 - 96 s + 120

Graph:
MATLAB code:
clc
clear all;
close all;
g1=tf([1],[1 10]);
g2=tf([1],[1 1]);
g3=tf([1 0 1],[1 4 4]);
g4=tf([1 1],[1 6]);
h1=tf([1 1],[1 2]);
h2=tf([2],[1]);
h3=tf([1],[1]);
sys1=series(g3,g4);
sys2=feedback(sys1,h1,+1);
sys3=series(g2,sys2);
sys4=feedback(sys3,h2/g4,-1);
sys5=series(g1,sys4);
sys6=feedback(sys5,h3,-1)

Output:
Transfer function:
             s^5 + 4 s^4 + 6 s^3 + 6 s^2 + 5 s + 2
----------------------------------------------------------------
12 s^6 + 205 s^5 + 1066 s^4 + 2517 s^3 + 3128 s^2 + 2196 s + 712

Excercise :02

MATLAB code:
clc
clear all;
close all;
g1=tf([1],[1 1]);
g2=tf([1 2],[1 3]);
sys=series(g1,g2);
sys1=feedback(sys,[1],-1)
step(sys1)
Output:
Transfer function:
    s + 2
-------------
s^2 + 5 s + 5

Graph:




Excercise :03

MATLAB code:
clc
clear all;
close all;
k=10.8*exp(8);
a=1;
b=8;
j=10.8*exp(8);
g1=tf([k k*a],[1 b]);
g2=tf([1],[j 0 0]);
sys=series(g1,g2);
sys1=feedback(sys,[1],-1)
step(sys1)

Output:
Transfer function:
                3.219e004 s + 3.219e004
-------------------------------------------------------
3.219e004 s^3 + 2.576e005 s^2 + 3.219e004 s + 3.219e004

Graph:

Excercise :04

MATLAB code:.
clc
clear all;
close all;
g1=tf([1  1],[1 2]);
g2=tf([1],[1 1]);
sys=feedback(g1,g2,-1)
p=pole(sys)
z=zero(sys)
subplot 211
pzmap(sys)
sysr = minreal(sys)
subplot 212
pzmap(sysr)

Output:
Transfer function:
s^2 + 2 s + 1
-------------
s^2 + 4 s + 3
p =
    -3
    -1
z =
    -1
    -1
Transfer function:
s + 1
-----
s + 3

Graph:









5.  Conclusion:-

2.      We can calculate that whole transfer function of two or more parallel systems by adding the transfer function these systems.
3.      We can calculate that whole transfer function of such systems in which feedback is involves by dividing foreword path whole transfer function by
                                                            1+whole transfer function (for negative feedback)
And
                                                            1-whole transfer function (for positive feedback)
4.      If a system have many gains (series, parallel and feedback gain) we can calculate the wholetransfer function of the system in MATLAB using built in commands as discussed above without solving on paper which is difficult.

5.      We can calculate the poles and zeros of close loop system ijn MATLAB by using built in command “pzmap” .

No comments:

Post a Comment