corrected Matlab Assignment

Embed Size (px)

Citation preview

  • 7/27/2019 corrected Matlab Assignment

    1/10

    Assignment No1

    Solution 1:

    Program:

    prompt = 'Enter the value of k = ';

    k = input(prompt);

    num=[0 0 160*k 2880*k 2720*k];

    den=[1 180 (1700+160*k) 2880*k 2720*k];

    step(num,den);

    grid;

    title('Step Response');

    sys = tf([0 0 160*k 2880*k 2720*k],[1 180 (1700+160*k) 2880*k 2720*k]);

    S = stepinfo(sys,'RiseTimeLimits',[0.05,0.95])

    Result:

    Enter the value of k = 3

    S =

    RiseTime: 0.3419

    SettlingTime: 2.4192

    SettlingMin: 0.9543

    SettlingMax: 1.1508

    Overshoot: 15.0815

    Undershoot: 0

    Peak: 1.1508

    PeakTime: 0.7539

    Output plot is attached below:

  • 7/27/2019 corrected Matlab Assignment

    2/10

    0 0.5 1 1.5 2 2.5 3 3.50

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    1.4

    Step Response

    Time (sec)

    Amplitude

  • 7/27/2019 corrected Matlab Assignment

    3/10

    Ans 2:

    a)

    num=[0 0 10];

    den=[1 2 10];

    step(num,den);

    grid;

    title('Step Response');

    b)

    num=[0 0 10];

    den=[1 2 10];

    impulse(num,den);

    grid;

    title('Impulse Response');

    c)

    num=[0 10 0];

    den=[1 2 10];

    t=0:0.1:7;

    c=step(num,den,t);

    plot(t,c,'o',t,t,'--');

    grid;

    title('Ramp Response');

  • 7/27/2019 corrected Matlab Assignment

    4/10

    0 1 2 3 4 5 60

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    1.4

    Step Response

    Time (sec)

    Amplitude

  • 7/27/2019 corrected Matlab Assignment

    5/10

  • 7/27/2019 corrected Matlab Assignment

    6/10

    0 1 2 3 4 5 6 7-1

    0

    1

    2

    3

    4

    5

    6

    7Ramp Response

  • 7/27/2019 corrected Matlab Assignment

    7/10

    Ans 3:a)A=[-1 -0.5; 1 0];

    B=[0.5; 0];

    C=[1 0];

    D=[0];

    step(A,B,C,D);

    grid;

    title('Step Response');

    b)

    A=[-1 -0.5; 1 0];

    B=[0.5; 0];

    C=[1 0];

    D=[0];

    impulse (A,B,C,D);

    grid;

    title('Impulse Response');

    c)

    A=[-1 -0.5; 1 0];

    B=[0.5; 0];

    C=[1 0];

    D=[0];

    [n,e]=ss2tf(A,B,C,D);

    t=0:0.1:7;

    c=step(n,e,t);

    plot(t,c,'o',t,t,'--');

    grid;

    title('Ramp Response');

  • 7/27/2019 corrected Matlab Assignment

    8/10

    0 2 4 6 8 10 12 14-0.05

    0

    0.05

    0.1

    0.15

    0.2

    0.25

    0.3

    0.35

    Step Response

    Time (sec)

    Amplitude

  • 7/27/2019 corrected Matlab Assignment

    9/10

    0 1 2 3 4 5 6 7 8 9 10-0.2

    -0.1

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    Impulse Response

    Time (sec)

    Amplitude

  • 7/27/2019 corrected Matlab Assignment

    10/10

    0 1 2 3 4 5 6 7-1

    0

    1

    2

    3

    4

    5

    6

    7Ramp Response