Results 1 to 2 of 2

Math Help - Recursion in matlab?

  1. #1
    Newbie
    Joined
    Mar 2008
    Posts
    2

    Recursion in matlab?

    Hello. I do not understand how to write the following part in matlab.



    r(s,a)="reward" is a 16x4 matrix, so is delta(s,a). Gamma is a positive constant <1.


    This far:


    Code:
    function u1
    
    clc
    clear all
    close all
    
    %delta(state, action)=nextstate
    delta= [2 4 5 13;
            1 3 6 14;
            4 2 7 15;
            3 1 8 16;
            6 8 1 9;
            5 7 2 10;
            8 6 3 11;
            7 5 4 12;
            10 12 13 5;
            9 11 14 6;
            12 10 15 7;
            11 9 16 8;
            14 16 9 1;
            13 15 10 2;
            16 14 11 3;
            15 13 12 4];
        
    %reward(state, action)=reward
    N=-1; 
    B=-1; 
    F=1; 
    
    reward = [0    0     0    0;
              0    0     N    B;
              0    0     N    0;
              0    0     0    0;
              N    B     0    0;
              0    N     0    N;
              0    N     0    N;
              N    F     0    0;
              N    0     0    0;
              0    N     0    N;
              0    N     0    N;
              N    0     0    0;
              0    0     0    0;
              0    0     N    F;
              0    0     N    0;
              0    0     0    0]
    Thanks.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Mar 2008
    Posts
    2
    What I want to do is to calculate a policy vector pi(s) for each state s.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Recursion help.
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: March 28th 2010, 03:23 PM
  2. recursion
    Posted in the Discrete Math Forum
    Replies: 3
    Last Post: December 13th 2009, 08:00 AM
  3. Recursion Depth
    Posted in the Algebra Forum
    Replies: 0
    Last Post: October 27th 2009, 12:01 PM
  4. Recursion
    Posted in the Discrete Math Forum
    Replies: 4
    Last Post: September 30th 2008, 10:40 PM
  5. Recursion
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: September 16th 2008, 07:24 PM

Search Tags


/mathhelpforum @mathhelpforum