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” .

Monday, July 14, 2014

Lab 2 : Designing Analog Circuit












Control System

OBJECTIVES


  1. Able to list the application of control system
  2. Able to describe open-loop and closed-loop control system.
  3. Able to determine transfer function of a system.
  4. Able to perform block diagram reduction to obtain overall transfer function of a system.
  5. Able to compare analog and digital control.
  6. Able to describe the objective of control system design.

Control System


  • Control means to regulate, direct, command, or govern.
  • A system is a collection, set, or arrangement of elements (subsystems).
  • A control system is an interconnection of components forming a system configuration that will provide a desired system response.


Input & Output


  • The input is the stimulus, excitation, or command applied to a control system.
  • The output is the actual response resulting from a control system.
  • The output may or may not be equal to the specified response implied by the input.



Application


  • Control system applications are found in;
  • robotics
  •  space-vehicle systems
  • aircraft autopilots and controls
  •  ship and marine control systems
  •  intercontinental missile guidance systems
  • automatic control systems for hydrofoils
  • surface-effect ships
  • high-speed rail systems




Examples of Control Systems

Examples of man-made control systems:
Washing machine, radio antenna, rockets/missiles, robots, room air condition.


Examples of God-created control systems : entry of
light through the human eye, holding and carrying things using hand.


Open-loop Control System



A control system where the control (regulating) action is independent of the output.
The output from the system has no effect on the input signal to the plant or process.
Advantage: relatively simple, cheap and generally has a good reliability.


Disadvantages:


Often inaccurate since there is no correction for errors in the output which might result from disturbances.
There is no changing of the control action to account for any disturbances which change the output variable.



Elements of Open-loop Control System

Control element
→This determines the action to be taken as a  result of the input of the required value signal to the system
Correction element
→This has an input from the controller and gives an output of some action designed to change the variable being controlled.
Process
→This is the process of which a variable is being controlled.

Rules of Blogck Diagram Reduction

Assignment 1 Block












Introduction To Matlab











Lab 1 : Basic Logic Gates