w3 opp1

3
u = -inv(alpha^k * R + B'*S_k1*B)*B'*S_k1*A*x; alpha = .9; k = randi(100); R = diag(rand(2,1)); B = randn(4,2); A = randn(4); S_k1 = 100*diag(rand(4,1)); x = randn(4,1); % your solution to u below u = ; 1 2 3 4 5 6 7 8 9 10 LQR with discounting | Optional Problem | 6.832x Courseware | edX https://courses.edx.org/courses/MITx/6.832x/3T2014/courseware/wee... 1 of 3 10/01/2015 14:14 Edited with the trial version of Foxit Advanced PDF Editor To remove this notice, visit: www.foxitsoftware.com/shopping

Upload: alicealormenu

Post on 20-Nov-2015

212 views

Category:

Documents


0 download

DESCRIPTION

MIT Underactuated Robotics

TRANSCRIPT

  • u = -inv(alpha^k * R + B'*S_k1*B)*B'*S_k1*A*x;

    alpha = .9;

    k = randi(100);

    R = diag(rand(2,1));

    B = randn(4,2);

    A = randn(4);

    S_k1 = 100*diag(rand(4,1));

    x = randn(4,1);

    % your solution to u below

    u = ;

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    LQR with discounting | Optional Problem | 6.832x Courseware | edX https://courses.edx.org/courses/MITx/6.832x/3T2014/courseware/wee...

    1 of 3 10/01/2015 14:14

    Edited with the trial version of Foxit Advanced PDF Editor

    To remove this notice, visit:www.foxitsoftware.com/shopping

    http://www.foxitsoftware.com/shopping

  • M = A'*S_k1*B*inv(alpha^k*R + B'*S_k1*B)*B'*S_k1*A;

    alpha = .9;

    k = randi(100);

    R = diag(rand(2,1));

    B = randn(4,2);

    A = randn(4);

    S_k1 = 100*diag(rand(4,1));

    % your solution to u below

    M = ;

    alpha = .9;

    N = 10;

    A = [2 1; -3 .8];

    B = [0;1];

    Q = diag([5;1]);

    1

    2

    3

    4

    5

    6

    7

    8

    9

    1

    2

    3

    4

    5

    LQR with discounting | Optional Problem | 6.832x Courseware | edX https://courses.edx.org/courses/MITx/6.832x/3T2014/courseware/wee...

    2 of 3 10/01/2015 14:14

    Edited with the trial version of Foxit Advanced PDF Editor

    To remove this notice, visit:www.foxitsoftware.com/shopping

    http://www.foxitsoftware.com/shopping

  • S{N+1} = S_N;

    for k=N-1:-1:0,

    S_k1 = S{k+2};

    M = A'*S_k1*B*inv(alpha^k*R+B'*S_k1*B)*B'*S_k1*A;

    S{k+1} = alpha^k*Q - M + A'*S_k1*A;

    end

    S_0 = S{1}

    R = 1;

    S_N = 10*eye(2);

    S_0 =

    6

    7

    8

    9

    LQR with discounting | Optional Problem | 6.832x Courseware | edX https://courses.edx.org/courses/MITx/6.832x/3T2014/courseware/wee...

    3 of 3 10/01/2015 14:14

    Edited with the trial version of Foxit Advanced PDF Editor

    To remove this notice, visit:www.foxitsoftware.com/shopping

    http://www.foxitsoftware.com/shopping