contol system lab(matlab)[1]

Upload: teebhan-chanthira-seekaran

Post on 06-Apr-2018

239 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    1/96

    1.0 MATRICS,VECTORS AND SCALARS

    In MATLAB a scalar is a variable with one row

    and one column.

    Scalars are the simple variables that we use and

    manipulate in simple algebric

    1

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    2/96

    EXAMPLE 1

    >>a=[0:5]

    a =

    0 1 2 3 4 5

    2

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    3/96

    Example 2

    >>b=[10:20]

    b =

    10 11 12 13 14 15 16 17 18

    19 20

    3

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    4/96

    1.1 Creating scalar

    To create a scalar simply introduce it on the left

    hand side of an equal sign.

    Example

    >> x=1;

    >> y=2;

    >> Z=x+y

    Z =

    3

    4

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    5/96

    1.2 Demostration on scalar addition,

    subtraction, multiplication and division

    Example1

    >> u = 5;

    >> v = 3;

    >> w = u+v;

    >> x = u-v;

    >> y = u*v;

    >> z = u/v;

    >> w,x,y,z

    5

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    6/96

    w =

    8

    X=

    2

    y =

    15

    z =

    1.6667

    6

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    7/96

    Example 3

    >>x=3;

    >> y=4;

    >> z=x*y^2

    z =

    48

    7

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    8/96

    1.3 Creating Vectors

    In Matlab a vector is a matrix with either one row

    or one column.

    Example :

    1. To create a row vector of length 5, filled with

    5,

    >>x=ones(1,5)

    x =

    1 1 1 1 1

    8

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    9/96

    2. To create a column vector of length 5,filled

    with zeros.

    >>y=zeros(5,1)

    y =

    0

    0

    0 0

    0

    9

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    10/96

    Matrix

    Matrix is a set of number arranged in a

    rectangular grid of rows and columns.

    Example:

    >>A=[3 5]

    A =

    3 5

    10

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    11/96

    The size of matrix is specified by the numbers of rowsand column.

    If the matrix is same than it is called as square matrix.

    3. Semicolon is used to separate the rows.

    >>C=[1 2 3 ; 4 5 6 ; 7 8 9 ]

    C =

    1 2 3

    4 5 6

    7 8 9

    11

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    12/96

    4. If we want to extract the third column of

    matrix c, then we write

    C(:,3)

    ans =

    3

    6

    9

    12

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    13/96

    Simple Graphs

    Example 1

    To plot a simple graph

    >>x=[1;2;3;4;5];

    >> y=[0;.25;3;1.5;2];

    >> plot(x,y)

    13

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    14/96

    14

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    15/96

    Example 2

    >> x=0:5;

    >> y=sinh(x);

    >> plot(x,y)

    >> xlabel('Time')

    >> ylabel('Sinh')

    >> title('Sinehyperbolic')

    15

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    16/96

    16

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    17/96

    Example 3

    >> x=0:pi/100:2*pi;

    >> y=sin(x);

    >> plot(x,y)

    >> xlabel('x=0:2\pi')

    >> ylabel('Sin of x')

    >> title('Plot of the sin function')

    17

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    18/96

    18

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    19/96

    Multiple Graphs

    >> t=0:pi/100:2*pi;

    >> y1=sin(t);

    >> y2=sin(t+pi/2); >> plot(t,y1,t,y2)

    >> grid on

    19

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    20/96

    20

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    21/96

    Exercise

    For the graph above include the labels.

    For X-axis, Y-axis and title.

    21

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    22/96

    Solutions

    >> t=0:pi/100:2*pi;

    >> y1=sin(t);

    >> y2=sin(t+pi/2);

    >> plot(t,y1,t,y2)

    >> grid on

    >> xlabel('x=0:2\pi')

    >> ylabel=('y1=sin(t)')

    >> title('Multiple graphs')

    22

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    23/96

    23

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    24/96

    Root and convolution function

    1. For the given polynomial, find the roots

    a) P(s)=s2+6s+8

    b) P(s)=s2-8s+5

    c) P(s)=s2+2s-15

    24

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    25/96

    Solution

    a=

    >> p=[1 6 8];

    >> r=roots(p)

    r =

    -4

    -2

    25

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    26/96

    b=

    >>p=[1 -8 15];

    >> r=roots(p)

    r =

    5

    3

    26

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    27/96

    C =

    >>p=[1 2 -15];

    >>r =roots(p)

    -5

    3

    27

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    28/96

    Pole and Zero

    Find the zero and pole for the given

    transfer function

    T(s)= (s+2)

    ( s2+2s+1)

    28

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    29/96

    Solution

    >>sys=tf([1 2],[1 2 1]);

    >> p=pole(sys);

    >> z=zero(sys);

    >> p,z

    p =

    -1

    -1

    z =

    -2

    29

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    30/96

    Pole - zero map

    >>sys=tf([1 2],[1 2 1]);

    >> p=pole(sys);

    >> z=zero(sys); >> p,z

    >> pzmap(sys)

    30

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    31/96

    -2 -1.8 -1.6 -1.4 -1.2 -1 -0.8 -0.6 -0.4 -0.2 0-1

    -0.8

    -0.6

    -0.4

    -0.2

    0

    0.2

    0.4

    0.6

    0.8

    1Pole-Zero Map

    Re al Ax is

    Im

    aginary

    Axis

    zero

    pole

    31

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    32/96

    Excersice

    Show the pole and zero for the given transfer function in s- plane.

    T(s)= 6s2+1

    ( s3 +3s2 + 3s +1)

    32

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    33/96

    S- plane

    >>sys=tf([6 0 1],[1 3 3 1]);

    >> p=pole(sys);

    >> z=zero(sys);

    >> p,z

    p =

    -1.0000

    -1.0000 + 0.0000i

    -1.0000 - 0.0000i

    z =

    0 + 0.4082i

    0 - 0.4082i

    >> pzmap(sys)33

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    34/96

    -1 .4 -1 .2 -1 -0.8 -0 .6 -0 .4 -0 .2 0-0.5

    -0.4

    -0.3

    -0.2

    -0.1

    0

    0.1

    0.2

    0.3

    0.4

    0.5Pole-Zero Map

    Real Axis

    Im

    aginaryA

    xis

    34

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    35/96

    To construct transfer function

    1. Given numerator =(s+5)

    denominator =(s2 3s + 6)

    >> num=[1 5];

    >> den=[1 -3 6]; >> sys=tf(num,den)

    Transfer function:

    s + 5 -------------

    s^2 - 3 s + 6

    35

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    36/96

    Example 2

    2. Given numerator =(-s+6)

    denominator =(s2 + 4s + 4)

    >>num=[-1 6];

    >> den=[1 4 4]; >> sys=tf(num,den)

    Transfer function:

    - s + 6 -------------

    s^2 + 4 s + 4

    36

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    37/96

    Multiply the polynomials using conv

    functions

    1. Expand the following polynomials.

    a) N(s) = (3s2+2s+1)(s+4)

    b) Find the value of N(s) when s= -5

    >>p=[3 2 1]; >> q=[1 4];

    >> n=conv(p,q)

    n =

    3 14 9 4

    37

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    38/96

    To evaluate the value of N(s) when s=-5

    >>value=polyval(n,-5)

    >>value =

    -66

    38

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    39/96

    Exersice

    1. For the above polynomials, find the

    value of N(s) when s = 2 and s = -7

    2. Expand the following

    N(s)= (-3s3+5s+6)(5s2-7s+1)

    39

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    40/96

    Operator Addition (+)

    Given G1(s) = 10 / s2+2s+5 and G2(s) = 1 / s+1

    Using Matlab, perform the total of G1(s) + G2(s) .

    >>num1=[10];den1=[1 2 5];

    >> sys1=tf(num1,den1)

    Transfer function:

    10

    ------------- s^2 + 2 s + 5

    40

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    41/96

    >>num2=[1];den2=[1 1]; >> sys2=tf(num2,den2)

    Transfer function:

    1

    ----- s + 1

    >> sys=(sys1+sys2)

    Transfer function:

    s^2 + 12 s + 15 ---------------------

    s^3 + 3 s^2 + 7 s + 5

    41

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    42/96

    Exersice

    Add the following transfer functions by

    using Matlab. Given

    G1(s) = s

    2

    +2s / 2s

    2

    - 4s+6

    G2(s) = 2 / s+4

    42

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    43/96

    Series Connection

    Let the following transfer function be

    G1(s) = 1 / 500s2

    G2(s) = s+ 1 / s+2 When both are in cascade:

    U(s) Y(s)

    T(s) = Y(s) /U(s)

    Sys1

    ( G1)

    Sys2 (G2)

    43

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    44/96

    Solution

    >> numg1=[1];deng1=[500 0 0];

    >> sys1=tf(numg1,deng1);

    >> numg2=[1 1];deng2=[1 2];

    >> sys2=tf(numg2,deng2);

    >> sys=series(sys1,sys2)

    Transfer function:

    s + 1

    ------------------ 500 s^3 + 1000 s^2

    44

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    45/96

    Parallel Connection

    The following transfer functions is connected in parallel. Show the

    transfer function.

    numg1=[2 1];deng1=[1 2];

    >> sys1=tf(numg1,deng1);

    >> numg2=[1 3];deng2=[500 0 4]; >> sys2=tf(numg2,deng2);

    >> sys=parallel(sys1,sys2)

    Transfer function:

    1000 s^3 + 501 s^2 + 13 s + 10

    ------------------------------

    500 s^3 + 1000 s^2 + 4 s + 8

    45

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    46/96

    Feedback

    For the following block diagram, find the transfer

    function. R(s) Y(s)

    G(s)=1/ 500s2

    H(s)=(s+1) /(s+2)

    46

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    47/96

    Solution

    >>numg=[1];deng=[500 0 0];

    >> sysg=tf(numg,deng);

    >> numh=[1 1];denh=[1 2];

    >> sysh=tf(numh,denh);

    >> sys=feedback(sysg,sysh)

    Transfer function:

    s + 2

    --------------------------

    500 s^3 + 1000 s^2 + s + 1

    47

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    48/96

    Exercise

    1. For the given bolck diagram , find the

    transfer

    R(s) y(s)

    2/(s2 + 1) (S + 1)/ (s2 + 10)

    ((s2

    -3) / (2s3

    + 2s +1)

    48

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    49/96

    Solution

    >> numg=[1];deng=[500 0 0];

    >> sysg=tf(numg,deng);

    >> numh=[1 1];denh=[1 2];

    >> sysh=tf(numh,denh);

    >> sys=feedback(sysg,sysh)

    Transfer function:

    s + 2

    --------------------------

    500 s^3 + 1000 s^2 + s + 1

    49

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    50/96

    2. For the given block diagram, find the transfer

    function.

    R(s) Y(s)G1 =2 / (s

    2 + 1) G2 =(s +1)/ (s2 +10)

    H = ( s2 3) /

    (2s3+2s+1)

    50

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    51/96

    Solution

    >> numg1=[2];deng1=[1 0 1];sys1=tf(numg1,deng1);

    >> numg2=[1 1];deng2=[1 0 10];sys2=tf(numg2,deng2);

    >> sysg=series(sys1,sys2);

    >> numh1=[1 0 -3];denh1=[2 0 2 1];sysh=tf(numh1,denh1);

    >> sys=feedback(sysg,sysh)

    Transfer function:

    4 s^4 + 4 s^3 + 4 s^2 + 6 s + 2

    -------------------------------------------------

    2 s^7 + 24 s^5 + s^4 + 44 s^3 + 13 s^2 + 14 s + 4

    51

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    52/96

    Multiloop reduction

    For the given multi loop feedback system, compute the closed

    loop transfer function. Use series, parallel and feedback functions if

    necessary.

    G1 G2G3 G4

    H2

    H1

    H3

    R(s) Y(s)

    52

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    53/96

    53

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    54/96

    Five steps procedure is followed:

    Step 1 = Input the system transfer function

    into Matlab

    Step 2 = Move H2

    behind G4

    Step 3 = Eliminate G3G4 H1loop.

    Step 4 = Eliminate the loop containing

    H2.

    Step 5 = Eliminate the remaining loop and

    calculate T(s)

    54

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    55/96

    Solution

    >>ng1=[1];dg1=[1 10];sysg1=tf(ng1,dg1);

    >> ng2=[1];dg2=[1 1];sysg2=tf(ng2,dg2);

    >> ng3=[1 0 1];dg3=[1 4 4];sysg3=tf(ng3,dg3);

    >> ng4=[1 1];dg4=[1 6];sysg4=tf(ng4,dg4);

    >> nh1=[1 1];dh1=[1 2];sysh1=tf(nh1,dh1);

    >> nh2=[2];dh2=[1];sysh2=tf(nh2,dh2); >> nh3=[1];dh3=[1];sysh3=tf(nh3,dh3);

    >> sys1=sysh2/sysg4;

    >> sys2=series(sysg3,sysg4);

    >> sys3=feedback(sys2,sysh1,+1);

    >> sys4=series(sysg2,sysg3);

    >> sys5=feedback(sys4,sys1);

    >> sys6=series(sysg1,sys5);

    >> sys=feedback(sys6,[1])

    55

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    56/96

    Transfer function:

    s^5 +4 s^4+ 6s^3 + 6s^2 + 5s + 2

    -----------------------------------------------------------------------------------

    12S^6 +20s^5 + 1066 s^4 + 2517s^3 +3128s^2 + 2196s + 712

    56

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    57/96

    Root locus

    The function covered are rlocus, rlocfind and residue.

    rlocus and rlocfind :- used to obtain the root locus plots.

    residue: - used for partial fraction expansion of rotational

    functions.

    57

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    58/96

    Closed loop transfer function

    Consider the closed loop transfer function

    T(s) = K(s+1)(s+3) / s(s+2)(s+3)+K(s+1)

    Now use rlocus function to generate root locus plots.

    The general form of characteristics is 1 + K G(S) = 0

    Step 1: - Obtain the characeteristic equation in the formof 1 + K G(S) = 0 , where K is the parameter of interest.

    Step 2:- Use the rlocus function to generate the plots.

    [r,k]=rlocus(sys). r= complex and loot location

    K= gain vector

    58

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    59/96

    Generating a root locus plot

    Let

    >> p=[1 1]; q=[1 5 6 0];

    >>sys=tf(p,q);

    >>rlocus(sys)

    59

    Root Locus

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    60/96

    -3.5 -3 -2.5 -2 -1.5 -1 -0.5 0 0.5-8

    -6

    -4

    -2

    0

    2

    4

    6

    8Root Locus

    Real Ax is

    Im

    agina

    ry

    Axis

    60

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    61/96

    >>p=[1 1];q=[1 5 6 0];

    >> sys=tf(p,q);

    >> rlocus(sys);

    >> rlocfind(sys)

    Select a point in the graphics window

    selected_point =

    -2.4716 + 0.0248i

    ans =

    0.4195 This value will be vary. Depends on the selected value atgraph

    61

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    62/96

    Find the step response and also find the

    settling Time (Ts), Peak response(Ps)

    Let the value of K is 20.5775

    >>k=20.5775;num=k*[1 4 3];

    >>den=[1 5 6+k k];

    >> sys=tf(num,den); >> step(sys)

    62

    S t R

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    63/96

    S t ep Response

    T ime (sec )

    Amp

    litude

    0 0.5 1 1 .5 2 2 .5 30

    0.5

    1

    1.5

    2

    2.5

    3

    3.5

    4

    4.5

    Sys tem : sysT ime (sec ) : 0 .423Amplitude: 4.49

    Sys tem : sysTime (sec ) : 1.8Amplitude: 3.03

    63

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    64/96

    Exersice

    Compute step response for second order system when

    64

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    65/96

    Bode Diagram

    Bode The bode function is used togenerate a bode diagram.

    Logspace The logspace function

    generate a logarithmatically spaced vectorof frequencies utilized by the bodefunction.

    The magnitude and phase characteristicsare placed in the workspace through thevariables mag and phase.

    65

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    66/96

    Consider the transfer function given below:

    Plot the bode diagram.

    2

    250

    1

    50

    6.01)5.01(

    1.015

    ssss

    s=

    66

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    67/96

    Solution

    % Bode plot

    >> %

    >> num=5*[0.1 1];

    >> f1=[1 0];f2=[0.5 1]; f3=[1/2500 0.6/50 1]; >> den=conv(f1,conv(f2,f3));

    >> %

    >> sys=tf(num,den);

    >> bode(sys)

    >>

    67

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    68/96

    Excersice

    For the following transfer function sketch

    the Bode plots, then verify with Matlab

    a) G(s) =

    )10)(1(

    1

    ss

    68

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    69/96

    b) G(s) =)502(

    )10(2

    ss

    s

    69

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    70/96

    70

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    71/96

    Gain Margin and Phase margin can be

    determined from both Nyquist and Bode

    diagram. The gain margin is a measure of how much the

    system gain would have to be increased for the

    GH(jw) locus to pass through the (-1,0) point,

    thus resurlting in an unstable system.

    Example

    >> num=[0.5];den=[1 2 1 0.5];

    >> sys=tf(num,den); >> margin (sys)

    71

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    72/96

    -150

    -100

    -50

    0

    50

    Magnitude(dB)

    10- 2

    10- 1

    100

    101

    102

    -270

    -225

    -180

    -135

    -90

    -45

    0

    Phase(deg)

    Bode DiagramG m = 9.55 dB (a t 1 rad/sec) , Pm = 49 deg (a t 0 .644 rad/sec)

    F requency ( rad /sec )

    72

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    73/96

    NYQUISTPLOT

    This section covered Nyquist, Nichols,

    margin ,pade and ngrid functions.

    It is generally more difficult to manually

    generate the Nyquist plot than Bode

    diagram.

    When Nyquist function generated,

    automatically Nyquist plot is generated.

    73

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    74/96

    Example

    1. For the closed loop control system,

    shown below, plot Nyquist plot.

    5.02

    5.0

    23

    ss

    74

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    75/96

    Solution:

    >>num=[0.5];den=[1 2 1 0.5];

    >> sys=tf(num,den); >> nyquist (sys)

    75

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    76/96

    -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1-1.5

    -1

    -0.5

    0

    0.5

    1

    1.5Ny quist D iagram

    Real Ax is

    Imagina

    ryAxis

    76

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    77/96

    Example

    The nyquist plot for the below system with

    gain and phase margins.

    5.02

    5.0

    23

    sss

    77

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    78/96

    % The Nyquist plot

    % With a gain and phase margin calculation.

    >> num=[0.5];den=[1 2 1 0.5];

    >> sys=tf(num,den); >> [mag,phase,w]=bode(sys);

    >> [Gm,Pm,Wcg,Wcp]=margin(mag,phase,w);

    >> nyquist(sys);

    >> title(['Gm=',num2str(Gm),'Pm=',num2str(Pm)])

    78

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    79/96

    -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1-1.5

    -1

    -0.5

    0

    0.5

    1

    1.5Gm=3Pm=49.5753

    Re al Ax is

    Imaginary

    Axis

    79

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    80/96

    Using the Nyquist function, obtain the polar plot for the

    following transfer function.

    148

    20)(

    2

    !

    ss

    sG

    133

    10

    )( 23 ! ssssG

    80

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    81/96

    Nichols Chart

    Plot the nichols chart for the following

    transfer function

    81

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    82/96

    Solution

    >> num=[1];den=[0.2 1.2 10];

    >> sys=tf(num,den);

    >> w=logspace(-1,1,400); >> nichols(sys,w);

    >> ngrid

    82

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    83/96

    -360 -315 -270 -225 -180 -135 -90 -45 0-40

    -30

    -20

    -10

    0

    10

    20

    30

    40

    6 dB

    3 dB

    1 dB

    0.5 dB

    0.25 dB

    0 dB

    -1 dB

    -3 dB

    -6 dB

    -12 dB

    -20 dB

    -40 dB

    Nichols Chart

    Open-Loop Phase (deg)

    Open-Loop

    Gain(dB)

    83

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    84/96

    Exercise

    Draw the Nichols chart for the given

    transfer function.

    84

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    85/96

    >>num=[1];den=[0.6 2.3 1];

    >> sys=tf(num,den);

    >> nichols(sys); >> ngrid

    85

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    86/96

    -360 -315 -270 -225 -180 -135 -90 -45 0-100

    -80

    -60

    -40

    -20

    0

    20

    40

    6 dB3 dB

    1 dB0.5 dB

    0.25 dB

    0 dB

    -1 dB

    -3 dB

    -6 dB

    -12 dB

    -20 dB

    -40 dB

    -60 dB

    -80 dB

    -100 dB

    Nichols Chart

    Open-Loop Phase (deg)

    Open-LoopG

    ain(dB)

    86

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    87/96

    Building a Simple Model

    87

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    88/96

    Steps

    1.Entersimulink in MATLAB commandWindow

    2.Create a new model window by click

    New

    Library Simulink

    Untitled

    88

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    89/96

    3. To create the above model click the

    follwing library.

    - Sources Library

    - Sinks Library

    - Continuous Library

    - Signal Routing library

    4. Drag the respective blocks from the

    browser and drop it in the model window.

    89

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    90/96

    5. To view simulation output for 10

    second,

    - Open the scope block

    - Click simulationparameters from the

    simulation menu. Notice stop time for 10

    second. Then click OK. Close the dialog

    box.

    90

    Choose start from simulation and watch

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    91/96

    - Choose start from simulation and watch

    the traces of the scope blocks input.

    91

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    92/96

    6. To save choose save from the file

    menu and enter the filename and location.

    92

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    93/96

    Simulink

    Running a Demo Model

    1. Click the start button on the bottom left

    corner of the MATLAB command window.

    2. Select Demos from the menu.

    3. Click the simulink entry in the Demos

    panel.

    93

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    94/96

    4. Select any one of features.

    Simulink

    - Features

    - General

    - Automotive- Aerospace.

    94

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    95/96

    5. Click on demo link to start the demo.

    6. Simulink start.

    95

  • 8/3/2019 Contol System Lab(MATLAB)[1]

    96/96

    END