2nd Stage Optimization (Interpolated + Percentage + Risky + Safe Asse + Save + Borr + FIBSt)

back to Fan's Dynamic Assets Repository Table of Content.

Contents

function [mt_ev_condi_z_max, mt_ev_condi_z_max_idx, mt_ev_condi_z_max_kp, mt_ev_condi_z_max_bp] = ff_ipwkbz_fibs_evf(varargin)

FF_IPWKBZ_FIBS_EVF solves the k' vs b' problem given aggregate savings

This file is based on ff_ipwkbz_evf, see that file for more comments. Compare graphs side by side from this file and ff_ipwkbz_evf to see visually the effect of introducing formal and informal choices with bridge loan.

In contrast to ff_ipwkbz_evf.m, here, we need to deal with borrowing and savings formal and informal. These will change how the testing matrix is constructed. When bridge loan is allowed, we also need to construct the output matrixes differently. In ff_ipwkbz_evf.m, the assumption is that coh today does not matter, so to find optimal k* choice, we only need to know the aggregate savings level. But now, we need to know the coh level as well.

Below two reachable coh matrixes are constructed, one for when aggregate savings choice w >= 0, and another for when aggregate savings <= 0. Then they are stacked together. And we still have the same outputs as ff_ipwkbz_evf.m. The difference is that while for savings where w >=0, each row are w levels for the output matrixes, but for w <=0, each row is for w level + coh percentage combinations.

@param mt_val matrix state_n I^2 by shock_n. This is the value matrix each row is a feasible reachable state given the choice vectors/matrix and each column is a shock state.

@param param_map container parameter container

@param support_map container support container

@param armt_map container container with states, choices and shocks grids that are inputs for grid based solution algorithm

@return mt_ev_condi_z_max matrix (choice_w_pos_n + choice_w_neg_n x coh_perc_n) by shock_n max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w)) conditional on z and w, at the optimal k' choice (w=k'+b') what is the expected utility? This is the value result from the 2nd stage problem. Note the result integrates over z'.

@return mt_ev_condi_z_max_idx matrix (choice_w_pos_n + choice_w_neg_n x coh_perc_n) by (shock_n) this is the argmax from max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w)). Given the vector of k' choices, which index maximized conditional on z and w integrating over z'.

@return mt_ev_condi_z_max_kp matrix (choice_w_pos_n + choice_w_neg_n x coh_perc_n) by (shock_n) the k' choice at max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w))

@return mt_ev_condi_z_max_bp matrix (choice_w_pos_n + choice_w_neg_n x coh_perc_n) by (shock_n) the b'=w-k' choice at max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w))

@example

@include

Default

If comparing with ff_ipwkbz_evf, note that the borrowing and savings interest rates are the same there. Run st_param_which = 'default' to replicate identical result as ff_ipwkbz_evf.m.

if (~isempty(varargin))

    % override when called from outside
    [mt_val, param_map, support_map, armt_map] = varargin{:};

else
    clear all;
    close all;

    % Not default parameters, but parameters that generate defaults
    it_param_set = 4;
    bl_input_override = true;
    [param_map, support_map] = ffs_ipwkbz_fibs_set_default_param(it_param_set);

    support_map('bl_graph_evf') = true;
    support_map('bl_display_evf') = true;

    st_param_which = 'default';

    if (strcmp(st_param_which, 'default'))

        param_map('it_ak_perc_n') = 250;
        param_map('bl_bridge') = true;

    elseif (strcmp(st_param_which, 'small'))

        param_map('it_w_perc_n') = 7;
        param_map('it_ak_perc_n') = 7;
        param_map('it_coh_bridge_perc_n') = 3;
        param_map('fl_w_interp_grid_gap') = 2;
        param_map('fl_coh_interp_grid_gap') = 2;

        param_map('bl_bridge') = true;
        param_map('it_coh_bridge_perc_n') = 3;

    elseif (strcmp(st_param_which, 'ff_ipwkbz_evf'))

        param_map('fl_r_fsv') = 0.025;
        param_map('fl_r_inf') = 0.025;
        param_map('fl_r_inf_bridge') = 0.025;
        param_map('fl_r_fbr') = 0.025;
        param_map('it_ak_perc_n') = 250;

        param_map('bl_bridge') = false;
        param_map('it_coh_bridge_perc_n') = 1;

    end

    param_map('fl_w_interp_grid_gap') = (param_map('fl_w_max')-param_map('fl_b_bd'))/param_map('it_ak_perc_n');

    [armt_map, func_map] = ffs_ipwkbz_fibs_get_funcgrid(param_map, support_map, bl_input_override); % 1 for override

    % Generating Defaults
    params_group = values(armt_map, {'ar_ameshk_tnext_with_r', 'ar_k_mesha', 'ar_z'});
    [ar_ameshk_tnext_with_r, ar_k_mesha, ar_z] = params_group{:};
    params_group = values(func_map, {'f_util_standin'});
    [f_util_standin] = params_group{:};

    % works with replicating ff_ipwkbz_evf.m result
    mt_val = f_util_standin(ar_z, ar_ameshk_tnext_with_r, ar_k_mesha);

end

Parse Parameters

% armt_map
params_group = values(armt_map, {'mt_z_trans', 'ar_z',...
    'ar_w_level', 'ar_w_level_full', 'ar_coh_bridge_perc', ...
    'ar_k_mesha', 'ar_a_meshk', 'ar_ameshk_tnext_with_r', 'mt_k'});
[mt_z_trans, ar_z, ...
    ar_w_level, ar_w_level_full, ar_coh_bridge_perc, ...
    ar_k_mesha, ar_a_meshk, ar_ameshk_tnext_with_r, mt_k] = params_group{:};

% param_map
params_group = values(param_map, {'it_z_n', 'fl_nan_replace', 'fl_b_bd'});
[it_z_n, fl_nan_replace, fl_b_bd] = params_group{:};
params_group = values(param_map, {'bl_bridge'});
[bl_bridge] = params_group{:};

% support_map
params_group = values(support_map, {'bl_graph_onebyones','bl_display_evf', 'bl_graph_evf'});
[bl_graph_onebyones, bl_display_evf, bl_graph_evf] = params_group{:};
params_group = values(support_map, {'bl_img_save', 'st_img_path', 'st_img_prefix', 'st_img_name_main', 'st_img_suffix'});
[bl_img_save, st_img_path, st_img_prefix, st_img_name_main, st_img_suffix] = params_group{:};
params_group = values(support_map, {'it_display_summmat_rowmax', 'it_display_summmat_colmax'});
[it_display_summmat_rowmax, it_display_summmat_colmax] = params_group{:};

% append function name
st_func_name = 'ff_ipwkbz_evf';
st_img_name_main = [st_func_name st_img_name_main];

Integrate E(V(coh(k',b'), z')|z, w)

Each column for a different state z, each value E(V(coh,z')|z) integrated already Here, each column is a current z, more to right higher EV dim(mt_ev_condi_z): Q by M Note that: mt_ev_condi_z = mt_val*mt_z_trans' is a mistake, that would be what we do in the ffs_ipwkbz_set_functions code where we loop over current z, and for each current z, grab out a particular row from the mt_z_trans that corresponds to a current shock's transition into all future states.

here, each column of mt_val corresponds to a state z, think of that as future state z. The input mt_val is V(coh, z), we need to integrate to get E(V(coh,z')|z).

mt_ev_condi_z = mt_val*mt_z_trans';
if(bl_display_evf)
    disp('----------------------------------------');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp('mt_ev_condi_z: Q by M');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp(size(mt_ev_condi_z));
    disp(head(array2table(mt_ev_condi_z), 20));
    disp(tail(array2table(mt_ev_condi_z), 20));
end
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z: Q by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      932000          15

    mt_ev_condi_z1    mt_ev_condi_z2    mt_ev_condi_z3    mt_ev_condi_z4    mt_ev_condi_z5    mt_ev_condi_z6    mt_ev_condi_z7    mt_ev_condi_z8    mt_ev_condi_z9    mt_ev_condi_z10    mt_ev_condi_z11    mt_ev_condi_z12    mt_ev_condi_z13    mt_ev_condi_z14    mt_ev_condi_z15
    ______________    ______________    ______________    ______________    ______________    ______________    ______________    ______________    ______________    _______________    _______________    _______________    _______________    _______________    _______________

        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     
        -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912            -3.912             -3.912             -3.912             -3.912             -3.912             -3.912     

    mt_ev_condi_z1    mt_ev_condi_z2    mt_ev_condi_z3    mt_ev_condi_z4    mt_ev_condi_z5    mt_ev_condi_z6    mt_ev_condi_z7    mt_ev_condi_z8    mt_ev_condi_z9    mt_ev_condi_z10    mt_ev_condi_z11    mt_ev_condi_z12    mt_ev_condi_z13    mt_ev_condi_z14    mt_ev_condi_z15
    ______________    ______________    ______________    ______________    ______________    ______________    ______________    ______________    ______________    _______________    _______________    _______________    _______________    _______________    _______________

         4.194            4.1973            4.2012            4.2056            4.2105             4.216            4.2221            4.2289            4.2365            4.2449             4.2543             4.2646              4.276             4.2882             4.3004     
        4.1933            4.1966            4.2005            4.2049            4.2098            4.2153            4.2215            4.2283            4.2359            4.2443             4.2537             4.2641             4.2755             4.2877             4.2999     
        4.1926            4.1959            4.1998            4.2042            4.2092            4.2147            4.2208            4.2277            4.2353            4.2437             4.2531             4.2635              4.275             4.2872             4.2995     
        4.1919            4.1952            4.1991            4.2036            4.2085             4.214            4.2202             4.227            4.2347            4.2432             4.2526              4.263             4.2744             4.2867              4.299     
        4.1912            4.1946            4.1985            4.2029            4.2079            4.2134            4.2196            4.2264            4.2341            4.2426              4.252             4.2625             4.2739             4.2862             4.2985     
        4.1905            4.1939            4.1978            4.2022            4.2072            4.2127            4.2189            4.2258            4.2335             4.242             4.2514             4.2619             4.2734             4.2857              4.298     
        4.1898            4.1932            4.1971            4.2016            4.2065            4.2121            4.2183            4.2252            4.2329            4.2414             4.2509             4.2614             4.2729             4.2852             4.2976     
        4.1891            4.1925            4.1964            4.2009            4.2059            4.2114            4.2177            4.2246            4.2323            4.2408             4.2503             4.2608             4.2724             4.2847             4.2971     
        4.1884            4.1918            4.1957            4.2002            4.2052            4.2108             4.217            4.2239            4.2317            4.2402             4.2497             4.2603             4.2718             4.2842             4.2966     
        4.1878            4.1912            4.1951            4.1996            4.2046            4.2102            4.2164            4.2234            4.2311            4.2397             4.2492             4.2598             4.2714             4.2838             4.2962     
        4.1874            4.1908            4.1947            4.1992            4.2042            4.2098            4.2161             4.223            4.2308            4.2394             4.2489             4.2595             4.2711             4.2835              4.296     
         4.187            4.1904            4.1943            4.1988            4.2039            4.2095            4.2157            4.2227            4.2305            4.2391             4.2486             4.2592             4.2709             4.2833             4.2958     
        4.1866              4.19            4.1939            4.1984            4.2035            4.2091            4.2154            4.2224            4.2301            4.2388             4.2484              4.259             4.2706             4.2831             4.2956     
        4.1862            4.1896            4.1936            4.1981            4.2031            4.2088             4.215             4.222            4.2298            4.2385             4.2481             4.2587             4.2704             4.2828             4.2954     
        4.1858            4.1892            4.1932            4.1977            4.2027            4.2084            4.2147            4.2217            4.2295            4.2382             4.2478             4.2584             4.2701             4.2826             4.2952     
        4.1854            4.1888            4.1928            4.1973            4.2024             4.208            4.2143            4.2214            4.2292            4.2378             4.2475             4.2581             4.2699             4.2824              4.295     
        4.1849            4.1883            4.1923            4.1968            4.2019            4.2076            4.2139            4.2209            4.2288            4.2374             4.2471             4.2578             4.2695             4.2821             4.2947     
        4.1842            4.1876            4.1916            4.1962            4.2012            4.2069            4.2133            4.2203            4.2281            4.2369             4.2465             4.2572              4.269             4.2816             4.2942     
        4.1835            4.1869            4.1909            4.1955            4.2006            4.2063            4.2126            4.2197            4.2275            4.2363              4.246             4.2567             4.2685             4.2811             4.2937     
        4.1828            4.1862            4.1902            4.1948            4.1999            4.2056             4.212             4.219            4.2269            4.2357             4.2454             4.2561             4.2679             4.2805             4.2932     

Reshape E(V(coh,z'|z,w)) to allow for maxing

dim(mt_ev_condi_z): IxJ by M

[it_mt_bp_rown, it_mt_bp_coln] = size(mt_k);
mt_ev_condi_z_full = reshape(mt_ev_condi_z, [it_mt_bp_rown, it_mt_bp_coln*it_z_n]);

Maximize max_{k'}(E(V(coh(k',b'=w-k'),z'|z,w)) optimal value and index

Maximization, find optimal k'/b' combination given z and w=k'+b'

[ar_ev_condi_z_max, ar_ev_condi_z_max_idx] = max(mt_ev_condi_z_full);
mt_ev_condi_z_max = reshape(ar_ev_condi_z_max, [it_mt_bp_coln, it_z_n]);
mt_ev_condi_z_max_idx = reshape(ar_ev_condi_z_max_idx, [it_mt_bp_coln, it_z_n]);
if(bl_display_evf)

    disp('----------------------------------------');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp('mt_ev_condi_z_full: J by IxM');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp(size(mt_ev_condi_z_full));
%     disp(head(array2table(mt_ev_condi_z_full), 20));
%     disp(tail(array2table(mt_ev_condi_z_full), 20));


    disp('----------------------------------------');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp('mt_ev_condi_z_max: I by M');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp(size(mt_ev_condi_z_max));
    disp(head(array2table(mt_ev_condi_z_max), 20));
    disp(tail(array2table(mt_ev_condi_z_max), 20));


    disp('----------------------------------------');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp('mt_ev_condi_z_max_idx: I by M');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp(size(mt_ev_condi_z_max_idx));
    disp(head(array2table(mt_ev_condi_z_max_idx), 20));
    disp(tail(array2table(mt_ev_condi_z_max_idx), 20));

end
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_full: J by IxM
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
         250       55920

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_max: I by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        3728          15

    mt_ev_condi_z_max1    mt_ev_condi_z_max2    mt_ev_condi_z_max3    mt_ev_condi_z_max4    mt_ev_condi_z_max5    mt_ev_condi_z_max6    mt_ev_condi_z_max7    mt_ev_condi_z_max8    mt_ev_condi_z_max9    mt_ev_condi_z_max10    mt_ev_condi_z_max11    mt_ev_condi_z_max12    mt_ev_condi_z_max13    mt_ev_condi_z_max14    mt_ev_condi_z_max15
    __________________    __________________    __________________    __________________    __________________    __________________    __________________    __________________    __________________    ___________________    ___________________    ___________________    ___________________    ___________________    ___________________

           -3.912                -3.912                -3.912                -3.912                -3.912                -3.912                -3.912                -3.912                -3.912                -3.912                  -3.912                -3.912                 -3.912                 -3.912                 -3.912      
           -3.912                -3.912                -3.912                -3.912                -3.912                -3.912                -3.912               -3.9117               -3.9097               -3.8993                 -3.8587               -3.7381                 -3.465                -2.9937                -2.3746      
           -3.912                -3.912                -3.912               -3.9114               -3.9078               -3.8902                -3.827               -3.6584                 -3.32               -2.8007                 -2.1761               -1.5641                -1.0482               -0.64825               -0.34844      
          -3.9089                -3.895               -3.8418               -3.6925               -3.3809               -2.8911               -2.2972               -1.7197               -1.2391              -0.86538                 -0.5704               -0.3247               -0.11035               0.080161                0.24599      
          -2.8077               -2.3386               -1.9043               -1.5293               -1.2164              -0.95565              -0.72971              -0.52715              -0.34112               -0.1674              -0.0032415                0.1532                0.30271                 0.4441                 0.5725      
         -0.96657              -0.85085              -0.72638              -0.59345              -0.45567              -0.32015               -0.1873             -0.056758                0.0718               0.19864                 0.32396               0.44785                 0.5699                0.68817                0.79762      
         -0.36514              -0.29894              -0.22431              -0.14075             -0.049034              0.048925               0.14865               0.24977               0.35215               0.45569                 0.56028                0.6657                0.77135                0.87522                0.97245      
        0.0057698              0.052296               0.10584               0.16708               0.23979               0.31845               0.39982               0.48379               0.57022               0.65897                 0.74988               0.84271                0.93684                 1.0303                 1.1186      
          0.27527               0.31114               0.35295               0.40458                0.4676               0.53384                0.6032               0.67561               0.75098               0.82919                 0.91013               0.99357                 1.0789                 1.1643                 1.2455      
          0.48712               0.51636               0.55067               0.59605               0.65027               0.70776               0.76854               0.83277               0.90031               0.97093                  1.0445                 1.121                 1.1997                 1.2789                 1.3545      
          0.66181               0.68646               0.71556               0.75442               0.80098               0.85073               0.90368               0.96067                1.0226                1.0878                   1.156                1.2273                  1.301                 1.3755                 1.4469      
          0.81042               0.83174                 0.857                 0.891               0.93179               0.97563                1.0226                1.0734                1.1304                1.1911                   1.255                1.3219                 1.3915                 1.4621                   1.53      
          0.93974               0.95853               0.98086                1.0111                1.0474                1.0865                1.1287                1.1747                1.2275                1.2845                  1.3447                 1.408                  1.474                 1.5412                  1.606      
           1.0542                 1.071                 1.091                1.1183                1.1509                1.1864                1.2246                1.2695                1.3199                1.3735                  1.4303                1.4903                  1.553                  1.617                 1.6788      
           1.1569                1.1721                1.1902                 1.215                1.2447                1.2771                1.3121                1.3563                1.4038                1.4546                  1.5085                1.5655                 1.6254                 1.6866                 1.7459      
           1.2501                1.2639                1.2805                1.3032                1.3304                1.3601                1.3925                1.4337                 1.478                1.5254                  1.5768                1.6315                 1.6891                  1.748                 1.8052      
           1.3353                 1.348                1.3632                1.3842                1.4094                1.4369                1.4669                1.5053                1.5466                1.5909                  1.6399                1.6925                  1.748                  1.805                 1.8603      
           1.4138                1.4256                1.4397                1.4591                1.4825                1.5081                1.5362                 1.572                1.6108                1.6524                  1.6988                1.7496                 1.8032                 1.8583                  1.912      
           1.4865                1.4975                1.5107                1.5288                1.5507                1.5747                1.6009                1.6346                 1.671                 1.711                   1.757                1.8059                 1.8577                 1.9111                 1.9631      
           1.5544                1.5646                1.5769                1.5939                1.6144                 1.637                1.6618                1.6935                1.7279                1.7679                  1.8122                1.8595                 1.9096                 1.9613                 2.0118      

    mt_ev_condi_z_max1    mt_ev_condi_z_max2    mt_ev_condi_z_max3    mt_ev_condi_z_max4    mt_ev_condi_z_max5    mt_ev_condi_z_max6    mt_ev_condi_z_max7    mt_ev_condi_z_max8    mt_ev_condi_z_max9    mt_ev_condi_z_max10    mt_ev_condi_z_max11    mt_ev_condi_z_max12    mt_ev_condi_z_max13    mt_ev_condi_z_max14    mt_ev_condi_z_max15
    __________________    __________________    __________________    __________________    __________________    __________________    __________________    __________________    __________________    ___________________    ___________________    ___________________    ___________________    ___________________    ___________________

          4.1976                4.1986                4.1998                4.2012                4.2029                 4.205                4.2074                4.2104                4.2139                 4.218                  4.223                 4.2289                 4.2358                 4.2436                 4.2521       
           4.202                4.2029                4.2041                4.2055                4.2073                4.2093                4.2118                4.2147                4.2182                4.2223                 4.2272                 4.2331                 4.2399                 4.2478                 4.2562       
          4.2063                4.2072                4.2084                4.2099                4.2116                4.2136                4.2161                 4.219                4.2224                4.2266                 4.2315                 4.2373                 4.2441                 4.2519                 4.2603       
          4.2106                4.2116                4.2127                4.2142                4.2159                4.2179                4.2203                4.2232                4.2267                4.2308                 4.2357                 4.2415                 4.2483                 4.2561                 4.2644       
          4.2149                4.2159                 4.217                4.2184                4.2201                4.2222                4.2246                4.2275                4.2309                 4.235                 4.2399                 4.2456                 4.2524                 4.2602                 4.2685       
          4.2192                4.2201                4.2213                4.2227                4.2244                4.2264                4.2288                4.2317                4.2351                4.2392                 4.2441                 4.2498                 4.2566                 4.2643                 4.2725       
          4.2235                4.2244                4.2256                 4.227                4.2287                4.2307                4.2331                4.2359                4.2393                4.2434                 4.2482                 4.2539                 4.2607                 4.2683                 4.2766       
          4.2277                4.2286                4.2298                4.2312                4.2329                4.2349                4.2373                4.2401                4.2435                4.2475                 4.2524                 4.2581                 4.2648                 4.2724                 4.2806       
          4.2319                4.2329                 4.234                4.2354                4.2371                4.2391                4.2415                4.2443                4.2477                4.2517                 4.2565                 4.2622                 4.2688                 4.2764                 4.2846       
          4.2362                4.2371                4.2382                4.2396                4.2413                4.2433                4.2456                4.2485                4.2518                4.2558                 4.2606                 4.2662                 4.2729                 4.2805                 4.2886       
          4.2403                4.2413                4.2424                4.2438                4.2454                4.2474                4.2498                4.2526                4.2559                4.2599                 4.2647                 4.2703                 4.2769                 4.2845                 4.2926       
          4.2445                4.2454                4.2466                4.2479                4.2496                4.2516                4.2539                4.2567                4.2601                 4.264                 4.2688                 4.2744                  4.281                 4.2885                 4.2965       
          4.2487                4.2496                4.2507                4.2521                4.2537                4.2557                 4.258                4.2608                4.2641                4.2681                 4.2728                 4.2784                  4.285                 4.2925                 4.3005       
          4.2528                4.2537                4.2548                4.2562                4.2579                4.2598                4.2621                4.2649                4.2682                4.2722                 4.2769                 4.2824                  4.289                 4.2964                 4.3044       
          4.2569                4.2578                 4.259                4.2603                 4.262                4.2639                4.2662                 4.269                4.2723                4.2762                 4.2809                 4.2864                 4.2929                 4.3004                 4.3083       
           4.261                4.2619                4.2631                4.2644                 4.266                 4.268                4.2703                 4.273                4.2763                4.2802                 4.2849                 4.2904                 4.2969                 4.3043                 4.3122       
          4.2651                 4.266                4.2671                4.2685                4.2701                 4.272                4.2743                4.2771                4.2804                4.2843                 4.2889                 4.2944                 4.3008                 4.3082                 4.3161       
          4.2692                4.2701                4.2712                4.2726                4.2742                4.2761                4.2784                4.2811                4.2844                4.2882                 4.2929                 4.2983                 4.3048                 4.3121                   4.32       
          4.2733                4.2741                4.2753                4.2766                4.2782                4.2801                4.2824                4.2851                4.2884                4.2922                 4.2968                 4.3023                 4.3087                  4.316                 4.3239       
          4.2773                4.2782                4.2793                4.2806                4.2822                4.2841                4.2864                4.2891                4.2923                4.2962                 4.3008                 4.3062                 4.3126                 4.3199                 4.3277       

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_max_idx: I by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        3728          15

    mt_ev_condi_z_max_idx1    mt_ev_condi_z_max_idx2    mt_ev_condi_z_max_idx3    mt_ev_condi_z_max_idx4    mt_ev_condi_z_max_idx5    mt_ev_condi_z_max_idx6    mt_ev_condi_z_max_idx7    mt_ev_condi_z_max_idx8    mt_ev_condi_z_max_idx9    mt_ev_condi_z_max_idx10    mt_ev_condi_z_max_idx11    mt_ev_condi_z_max_idx12    mt_ev_condi_z_max_idx13    mt_ev_condi_z_max_idx14    mt_ev_condi_z_max_idx15
    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    _______________________    _______________________    _______________________    _______________________    _______________________    _______________________

               1                         1                         1                         1                         1                         1                         1                         1                         1                          1                          1                          1                          1                          1                          1          
             250                       250                       250                       250                       250                       250                       250                       250                       250                        250                        250                        250                        250                        250                        250          
             250                       250                       250                       250                       250                       250                       250                       250                       250                        250                        250                        250                        250                        250                        250          
             250                       250                       250                       250                       250                       250                       250                       250                       250                        250                        250                        250                        250                        250                        250          
             221                       221                       222                       250                       250                       250                       250                       250                       250                        250                        250                        250                        250                        250                        250          
             177                       177                       196                       233                       250                       250                       250                       250                       250                        250                        250                        250                        250                        250                        250          
             148                       148                       168                       200                       238                       250                       250                       250                       250                        250                        250                        250                        250                        250                        250          
             127                       127                       146                       174                       250                       250                       250                       250                       250                        250                        250                        250                        250                        250                        250          
             111                       111                       129                       250                       250                       250                       250                       250                       250                        250                        250                        250                        250                        250                        250          
              99                        99                       115                       245                       245                       245                       246                       250                       250                        250                        250                        250                        250                        250                        250          
              89                        89                       104                       221                       221                       221                       221                       249                       250                        250                        250                        250                        250                        250                        250          
              81                        81                        95                       201                       201                       201                       201                       227                       250                        250                        250                        250                        250                        250                        250          
              74                        75                        87                       184                       184                       184                       185                       209                       250                        250                        250                        250                        250                        250                        250          
              69                        69                        81                       170                       170                       170                       170                       250                       250                        250                        250                        250                        250                        250                        250          
              64                        64                        75                       158                       158                       158                       158                       250                       250                        250                        250                        250                        250                        250                        250          
              60                        60                        70                       147                       147                       148                       148                       236                       236                        239                        250                        250                        250                        250                        250          
              56                        56                        66                       138                       138                       138                       221                       221                       221                        224                        250                        250                        250                        250                        250          
              53                        53                        62                       130                       130                       130                       208                       208                       208                        211                        250                        250                        250                        250                        250          
              50                        50                        59                       123                       123                       123                       196                       196                       197                        250                        250                        250                        250                        250                        250          
              47                        48                        56                       116                       117                       117                       186                       186                       186                        250                        250                        250                        250                        250                        250          

    mt_ev_condi_z_max_idx1    mt_ev_condi_z_max_idx2    mt_ev_condi_z_max_idx3    mt_ev_condi_z_max_idx4    mt_ev_condi_z_max_idx5    mt_ev_condi_z_max_idx6    mt_ev_condi_z_max_idx7    mt_ev_condi_z_max_idx8    mt_ev_condi_z_max_idx9    mt_ev_condi_z_max_idx10    mt_ev_condi_z_max_idx11    mt_ev_condi_z_max_idx12    mt_ev_condi_z_max_idx13    mt_ev_condi_z_max_idx14    mt_ev_condi_z_max_idx15
    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    _______________________    _______________________    _______________________    _______________________    _______________________    _______________________

              8                         9                         11                        13                        15                        18                        22                        26                        31                        36                         43                         52                         61                         73                         85           
              8                         9                         11                        13                        15                        18                        22                        26                        30                        36                         43                         51                         61                         72                         85           
              8                         9                         11                        13                        15                        18                        21                        26                        30                        36                         43                         51                         61                         72                         84           
              8                         9                         11                        13                        15                        18                        21                        25                        30                        36                         43                         51                         61                         72                         84           
              8                         9                         11                        13                        15                        18                        21                        25                        30                        36                         43                         51                         60                         71                         83           
              8                         9                         11                        13                        15                        18                        21                        25                        30                        36                         42                         51                         60                         71                         83           
              8                         9                         11                        13                        15                        18                        21                        25                        30                        35                         42                         50                         60                         71                         83           
              8                         9                         11                        13                        15                        18                        21                        25                        30                        35                         42                         50                         60                         71                         82           
              8                         9                         11                        13                        15                        18                        21                        25                        30                        35                         42                         50                         59                         70                         82           
              8                         9                         11                        13                        15                        18                        21                        25                        29                        35                         42                         50                         59                         70                         82           
              8                         9                         11                        12                        15                        17                        21                        25                        29                        35                         42                         50                         59                         70                         81           
              8                         9                         11                        12                        15                        17                        21                        25                        29                        35                         41                         49                         59                         69                         81           
              8                         9                         10                        12                        15                        17                        21                        24                        29                        35                         41                         49                         58                         69                         81           
              8                         9                         10                        12                        15                        17                        21                        24                        29                        34                         41                         49                         58                         69                         80           
              8                         9                         10                        12                        15                        17                        20                        24                        29                        34                         41                         49                         58                         69                         80           
              8                         9                         10                        12                        14                        17                        20                        24                        29                        34                         41                         49                         58                         68                         80           
              8                         9                         10                        12                        14                        17                        20                        24                        29                        34                         41                         48                         57                         68                         79           
              8                         9                         10                        12                        14                        17                        20                        24                        29                        34                         40                         48                         57                         68                         79           
              8                         9                         10                        12                        14                        17                        20                        24                        28                        34                         40                         48                         57                         67                         79           
              7                         9                         10                        12                        14                        17                        20                        24                        28                        34                         40                         48                         57                         67                         78           

Reindex K' and B' Choices for each State at the Optimal w'=k'+b' choice

The K' and B' Optimal Choices Associated with EV opti dim(mt_ev_condi_z_max_kp): I by M

ar_add_grid = linspace(0, it_mt_bp_rown*(it_mt_bp_coln-1), it_mt_bp_coln);
mt_ev_condi_z_max_idx = mt_ev_condi_z_max_idx + ar_add_grid';

if(bl_display_evf)
    disp('----------------------------------------');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp('mt_ev_condi_z_max_idx: I by M');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp(size(mt_ev_condi_z_max_idx));
    disp(head(array2table(mt_ev_condi_z_max_idx), 20));
    disp(tail(array2table(mt_ev_condi_z_max_idx), 20));
end

mt_ev_condi_z_max_kp = reshape(ar_k_mesha(mt_ev_condi_z_max_idx), [it_mt_bp_coln, it_z_n]);
mt_ev_condi_z_max_bp = reshape(ar_a_meshk(mt_ev_condi_z_max_idx), [it_mt_bp_coln, it_z_n]);

if(bl_display_evf)
    disp('----------------------------------------');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp('mt_ev_condi_z_max_kp: I by M');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp(size(mt_ev_condi_z_max_kp));
    disp(head(array2table(mt_ev_condi_z_max_kp), 20));
    disp(tail(array2table(mt_ev_condi_z_max_kp), 20));

    disp('----------------------------------------');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp('mt_ev_condi_z_max_bp: I by M');
    disp('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    disp(size(mt_ev_condi_z_max_bp));
    disp(head(array2table(mt_ev_condi_z_max_bp), 20));
    disp(tail(array2table(mt_ev_condi_z_max_bp), 20));
end
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_max_idx: I by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        3728          15

    mt_ev_condi_z_max_idx1    mt_ev_condi_z_max_idx2    mt_ev_condi_z_max_idx3    mt_ev_condi_z_max_idx4    mt_ev_condi_z_max_idx5    mt_ev_condi_z_max_idx6    mt_ev_condi_z_max_idx7    mt_ev_condi_z_max_idx8    mt_ev_condi_z_max_idx9    mt_ev_condi_z_max_idx10    mt_ev_condi_z_max_idx11    mt_ev_condi_z_max_idx12    mt_ev_condi_z_max_idx13    mt_ev_condi_z_max_idx14    mt_ev_condi_z_max_idx15
    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    _______________________    _______________________    _______________________    _______________________    _______________________    _______________________

                1                         1                         1                         1                         1                         1                         1                         1                         1                         1                          1                          1                          1                          1                          1          
              500                       500                       500                       500                       500                       500                       500                       500                       500                       500                        500                        500                        500                        500                        500          
              750                       750                       750                       750                       750                       750                       750                       750                       750                       750                        750                        750                        750                        750                        750          
             1000                      1000                      1000                      1000                      1000                      1000                      1000                      1000                      1000                      1000                       1000                       1000                       1000                       1000                       1000          
             1221                      1221                      1222                      1250                      1250                      1250                      1250                      1250                      1250                      1250                       1250                       1250                       1250                       1250                       1250          
             1427                      1427                      1446                      1483                      1500                      1500                      1500                      1500                      1500                      1500                       1500                       1500                       1500                       1500                       1500          
             1648                      1648                      1668                      1700                      1738                      1750                      1750                      1750                      1750                      1750                       1750                       1750                       1750                       1750                       1750          
             1877                      1877                      1896                      1924                      2000                      2000                      2000                      2000                      2000                      2000                       2000                       2000                       2000                       2000                       2000          
             2111                      2111                      2129                      2250                      2250                      2250                      2250                      2250                      2250                      2250                       2250                       2250                       2250                       2250                       2250          
             2349                      2349                      2365                      2495                      2495                      2495                      2496                      2500                      2500                      2500                       2500                       2500                       2500                       2500                       2500          
             2589                      2589                      2604                      2721                      2721                      2721                      2721                      2749                      2750                      2750                       2750                       2750                       2750                       2750                       2750          
             2831                      2831                      2845                      2951                      2951                      2951                      2951                      2977                      3000                      3000                       3000                       3000                       3000                       3000                       3000          
             3074                      3075                      3087                      3184                      3184                      3184                      3185                      3209                      3250                      3250                       3250                       3250                       3250                       3250                       3250          
             3319                      3319                      3331                      3420                      3420                      3420                      3420                      3500                      3500                      3500                       3500                       3500                       3500                       3500                       3500          
             3564                      3564                      3575                      3658                      3658                      3658                      3658                      3750                      3750                      3750                       3750                       3750                       3750                       3750                       3750          
             3810                      3810                      3820                      3897                      3897                      3898                      3898                      3986                      3986                      3989                       4000                       4000                       4000                       4000                       4000          
             4056                      4056                      4066                      4138                      4138                      4138                      4221                      4221                      4221                      4224                       4250                       4250                       4250                       4250                       4250          
             4303                      4303                      4312                      4380                      4380                      4380                      4458                      4458                      4458                      4461                       4500                       4500                       4500                       4500                       4500          
             4550                      4550                      4559                      4623                      4623                      4623                      4696                      4696                      4697                      4750                       4750                       4750                       4750                       4750                       4750          
             4797                      4798                      4806                      4866                      4867                      4867                      4936                      4936                      4936                      5000                       5000                       5000                       5000                       5000                       5000          

    mt_ev_condi_z_max_idx1    mt_ev_condi_z_max_idx2    mt_ev_condi_z_max_idx3    mt_ev_condi_z_max_idx4    mt_ev_condi_z_max_idx5    mt_ev_condi_z_max_idx6    mt_ev_condi_z_max_idx7    mt_ev_condi_z_max_idx8    mt_ev_condi_z_max_idx9    mt_ev_condi_z_max_idx10    mt_ev_condi_z_max_idx11    mt_ev_condi_z_max_idx12    mt_ev_condi_z_max_idx13    mt_ev_condi_z_max_idx14    mt_ev_condi_z_max_idx15
    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________    _______________________    _______________________    _______________________    _______________________    _______________________    _______________________

          9.2701e+05                9.2701e+05                9.2701e+05                9.2701e+05                9.2702e+05                9.2702e+05                9.2702e+05                9.2703e+05                9.2703e+05                9.2704e+05                 9.2704e+05                 9.2705e+05                 9.2706e+05                 9.2707e+05                 9.2709e+05       
          9.2726e+05                9.2726e+05                9.2726e+05                9.2726e+05                9.2727e+05                9.2727e+05                9.2727e+05                9.2728e+05                9.2728e+05                9.2729e+05                 9.2729e+05                  9.273e+05                 9.2731e+05                 9.2732e+05                 9.2734e+05       
          9.2751e+05                9.2751e+05                9.2751e+05                9.2751e+05                9.2752e+05                9.2752e+05                9.2752e+05                9.2753e+05                9.2753e+05                9.2754e+05                 9.2754e+05                 9.2755e+05                 9.2756e+05                 9.2757e+05                 9.2758e+05       
          9.2776e+05                9.2776e+05                9.2776e+05                9.2776e+05                9.2777e+05                9.2777e+05                9.2777e+05                9.2778e+05                9.2778e+05                9.2779e+05                 9.2779e+05                  9.278e+05                 9.2781e+05                 9.2782e+05                 9.2783e+05       
          9.2801e+05                9.2801e+05                9.2801e+05                9.2801e+05                9.2802e+05                9.2802e+05                9.2802e+05                9.2803e+05                9.2803e+05                9.2804e+05                 9.2804e+05                 9.2805e+05                 9.2806e+05                 9.2807e+05                 9.2808e+05       
          9.2826e+05                9.2826e+05                9.2826e+05                9.2826e+05                9.2827e+05                9.2827e+05                9.2827e+05                9.2828e+05                9.2828e+05                9.2829e+05                 9.2829e+05                  9.283e+05                 9.2831e+05                 9.2832e+05                 9.2833e+05       
          9.2851e+05                9.2851e+05                9.2851e+05                9.2851e+05                9.2852e+05                9.2852e+05                9.2852e+05                9.2853e+05                9.2853e+05                9.2854e+05                 9.2854e+05                 9.2855e+05                 9.2856e+05                 9.2857e+05                 9.2858e+05       
          9.2876e+05                9.2876e+05                9.2876e+05                9.2876e+05                9.2877e+05                9.2877e+05                9.2877e+05                9.2878e+05                9.2878e+05                9.2879e+05                 9.2879e+05                  9.288e+05                 9.2881e+05                 9.2882e+05                 9.2883e+05       
          9.2901e+05                9.2901e+05                9.2901e+05                9.2901e+05                9.2902e+05                9.2902e+05                9.2902e+05                9.2903e+05                9.2903e+05                9.2904e+05                 9.2904e+05                 9.2905e+05                 9.2906e+05                 9.2907e+05                 9.2908e+05       
          9.2926e+05                9.2926e+05                9.2926e+05                9.2926e+05                9.2927e+05                9.2927e+05                9.2927e+05                9.2928e+05                9.2928e+05                9.2929e+05                 9.2929e+05                  9.293e+05                 9.2931e+05                 9.2932e+05                 9.2933e+05       
          9.2951e+05                9.2951e+05                9.2951e+05                9.2951e+05                9.2952e+05                9.2952e+05                9.2952e+05                9.2953e+05                9.2953e+05                9.2954e+05                 9.2954e+05                 9.2955e+05                 9.2956e+05                 9.2957e+05                 9.2958e+05       
          9.2976e+05                9.2976e+05                9.2976e+05                9.2976e+05                9.2977e+05                9.2977e+05                9.2977e+05                9.2978e+05                9.2978e+05                9.2979e+05                 9.2979e+05                  9.298e+05                 9.2981e+05                 9.2982e+05                 9.2983e+05       
          9.3001e+05                9.3001e+05                9.3001e+05                9.3001e+05                9.3002e+05                9.3002e+05                9.3002e+05                9.3002e+05                9.3003e+05                9.3004e+05                 9.3004e+05                 9.3005e+05                 9.3006e+05                 9.3007e+05                 9.3008e+05       
          9.3026e+05                9.3026e+05                9.3026e+05                9.3026e+05                9.3027e+05                9.3027e+05                9.3027e+05                9.3027e+05                9.3028e+05                9.3028e+05                 9.3029e+05                  9.303e+05                 9.3031e+05                 9.3032e+05                 9.3033e+05       
          9.3051e+05                9.3051e+05                9.3051e+05                9.3051e+05                9.3052e+05                9.3052e+05                9.3052e+05                9.3052e+05                9.3053e+05                9.3053e+05                 9.3054e+05                 9.3055e+05                 9.3056e+05                 9.3057e+05                 9.3058e+05       
          9.3076e+05                9.3076e+05                9.3076e+05                9.3076e+05                9.3076e+05                9.3077e+05                9.3077e+05                9.3077e+05                9.3078e+05                9.3078e+05                 9.3079e+05                  9.308e+05                 9.3081e+05                 9.3082e+05                 9.3083e+05       
          9.3101e+05                9.3101e+05                9.3101e+05                9.3101e+05                9.3101e+05                9.3102e+05                9.3102e+05                9.3102e+05                9.3103e+05                9.3103e+05                 9.3104e+05                 9.3105e+05                 9.3106e+05                 9.3107e+05                 9.3108e+05       
          9.3126e+05                9.3126e+05                9.3126e+05                9.3126e+05                9.3126e+05                9.3127e+05                9.3127e+05                9.3127e+05                9.3128e+05                9.3128e+05                 9.3129e+05                  9.313e+05                 9.3131e+05                 9.3132e+05                 9.3133e+05       
          9.3151e+05                9.3151e+05                9.3151e+05                9.3151e+05                9.3151e+05                9.3152e+05                9.3152e+05                9.3152e+05                9.3153e+05                9.3153e+05                 9.3154e+05                 9.3155e+05                 9.3156e+05                 9.3157e+05                 9.3158e+05       
          9.3176e+05                9.3176e+05                9.3176e+05                9.3176e+05                9.3176e+05                9.3177e+05                9.3177e+05                9.3177e+05                9.3178e+05                9.3178e+05                 9.3179e+05                  9.318e+05                 9.3181e+05                 9.3182e+05                 9.3183e+05       

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_max_kp: I by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        3728          15

    mt_ev_condi_z_max_kp1    mt_ev_condi_z_max_kp2    mt_ev_condi_z_max_kp3    mt_ev_condi_z_max_kp4    mt_ev_condi_z_max_kp5    mt_ev_condi_z_max_kp6    mt_ev_condi_z_max_kp7    mt_ev_condi_z_max_kp8    mt_ev_condi_z_max_kp9    mt_ev_condi_z_max_kp10    mt_ev_condi_z_max_kp11    mt_ev_condi_z_max_kp12    mt_ev_condi_z_max_kp13    mt_ev_condi_z_max_kp14    mt_ev_condi_z_max_kp15
    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________

                 0                        0                        0                        0                        0                        0                        0                        0                        0                        0                         0                         0                         0                         0                         0        
           0.28312                  0.28312                  0.28312                  0.28312                  0.28312                  0.28312                  0.28312                  0.28312                  0.28312                  0.28312                   0.28312                   0.28312                   0.28312                   0.28312                   0.28312        
           0.56623                  0.56623                  0.56623                  0.56623                  0.56623                  0.56623                  0.56623                  0.56623                  0.56623                  0.56623                   0.56623                   0.56623                   0.56623                   0.56623                   0.56623        
           0.84935                  0.84935                  0.84935                  0.84935                  0.84935                  0.84935                  0.84935                  0.84935                  0.84935                  0.84935                   0.84935                   0.84935                   0.84935                   0.84935                   0.84935        
            1.0007                   1.0007                   1.0053                   1.1325                   1.1325                   1.1325                   1.1325                   1.1325                   1.1325                   1.1325                    1.1325                    1.1325                    1.1325                    1.1325                    1.1325        
             1.001                    1.001                   1.1089                    1.319                   1.4156                   1.4156                   1.4156                   1.4156                   1.4156                   1.4156                    1.4156                    1.4156                    1.4156                    1.4156                    1.4156        
            1.0035                   1.0035                   1.1399                   1.3579                   1.6169                   1.6987                   1.6987                   1.6987                   1.6987                   1.6987                    1.6987                    1.6987                    1.6987                    1.6987                    1.6987        
            1.0038                   1.0038                   1.1549                   1.3775                   1.9818                   1.9818                   1.9818                   1.9818                   1.9818                   1.9818                    1.9818                    1.9818                    1.9818                    1.9818                    1.9818        
            1.0018                   1.0018                   1.1654                   2.2649                   2.2649                   2.2649                   2.2649                   2.2649                   2.2649                   2.2649                    2.2649                    2.2649                    2.2649                    2.2649                    2.2649        
            1.0044                   1.0044                    1.168                   2.4969                   2.4969                   2.4969                   2.5072                   2.5481                   2.5481                   2.5481                    2.5481                    2.5481                    2.5481                    2.5481                    2.5481        
            1.0024                   1.0024                   1.1728                   2.5018                   2.5018                   2.5018                   2.5018                   2.8198                   2.8312                   2.8312                    2.8312                    2.8312                    2.8312                    2.8312                    2.8312        
            1.0027                   1.0027                   1.1776                   2.5021                   2.5021                   2.5021                   2.5021                   2.8269                   3.1143                   3.1143                    3.1143                    3.1143                    3.1143                    3.1143                    3.1143        
           0.99843                   1.0121                   1.1756                   2.4978                   2.4978                   2.4978                   2.5114                   2.8386                   3.3974                   3.3974                    3.3974                    3.3974                    3.3974                    3.3974                    3.3974        
            1.0078                   1.0078                    1.185                   2.4992                   2.4992                   2.4992                   2.4992                   3.6805                   3.6805                   3.6805                    3.6805                    3.6805                    3.6805                    3.6805                    3.6805        
            1.0058                   1.0058                   1.1807                   2.5006                   2.5006                   2.5006                   2.5006                   3.9636                   3.9636                   3.9636                    3.9636                    3.9636                    3.9636                    3.9636                    3.9636        
            1.0095                   1.0095                   1.1799                   2.4918                   2.4918                   2.5089                   2.5089                   4.0082                   4.0082                   4.0593                    4.2468                    4.2468                    4.2468                    4.2468                    4.2468        
            1.0041                   1.0041                   1.1858                   2.4944                   2.4944                   2.4944                   4.0028                   4.0028                   4.0028                   4.0574                    4.5299                    4.5299                    4.5299                    4.5299                    4.5299        
            1.0089                   1.0089                   1.1827                   2.4958                   2.4958                   2.4958                    4.002                    4.002                    4.002                   4.0599                     4.813                     4.813                     4.813                     4.813                     4.813        
            1.0069                   1.0069                    1.191                   2.4995                   2.4995                   2.4995                    3.992                    3.992                   4.0125                   5.0961                    5.0961                    5.0961                    5.0961                    5.0961                    5.0961        
           0.99814                   1.0197                   1.1924                   2.4873                   2.5089                   2.5089                    3.998                    3.998                    3.998                   5.3792                    5.3792                    5.3792                    5.3792                    5.3792                    5.3792        

    mt_ev_condi_z_max_kp1    mt_ev_condi_z_max_kp2    mt_ev_condi_z_max_kp3    mt_ev_condi_z_max_kp4    mt_ev_condi_z_max_kp5    mt_ev_condi_z_max_kp6    mt_ev_condi_z_max_kp7    mt_ev_condi_z_max_kp8    mt_ev_condi_z_max_kp9    mt_ev_condi_z_max_kp10    mt_ev_condi_z_max_kp11    mt_ev_condi_z_max_kp12    mt_ev_condi_z_max_kp13    mt_ev_condi_z_max_kp14    mt_ev_condi_z_max_kp15
    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________

           1.8775                   2.1365                   2.6544                   3.1724                   3.6903                   4.4673                   5.5032                   6.5391                    7.834                    9.1289                    10.942                    13.273                    15.603                    18.711                    21.819        
           1.8857                   2.1458                   2.6661                   3.1863                   3.7065                   4.4869                   5.5273                   6.5678                   7.6083                     9.169                     10.99                    13.071                    15.672                    18.533                    21.915        
           1.8939                   2.1552                   2.6777                   3.2002                   3.7227                   4.5065                   5.2902                   6.5965                   7.6415                     9.209                    11.038                    13.128                     15.74                    18.614                    21.749        
           1.9022                   2.1646                   2.6893                   3.2141                   3.7389                   4.5261                   5.3132                   6.3628                   7.6747                    9.2491                    11.086                    13.185                    15.809                    18.695                    21.844        
           1.9104                   2.1739                    2.701                    3.228                   3.7551                   4.5457                   5.3362                   6.3903                   7.7079                    9.2891                    11.134                    13.242                    15.614                    18.512                    21.675        
           1.9187                   2.1833                   2.7126                    3.242                   3.7713                   4.5653                   5.3592                   6.4179                   7.7412                    9.3291                    10.917                    13.299                    15.681                    18.592                    21.768        
           1.9269                   2.1927                   2.7243                   3.2559                   3.7875                   4.5848                   5.3822                   6.4454                   7.7744                    9.1034                    10.964                     13.09                    15.748                    18.672                    21.862        
           1.9351                   2.2021                   2.7359                   3.2698                   3.8036                   4.6044                   5.4052                    6.473                   7.8076                    9.1423                    11.011                    13.146                    15.816                    18.752                    21.688        
           1.9434                   2.2114                   2.7476                   3.2837                   3.8198                    4.624                   5.4282                   6.5005                   7.8408                    9.1812                    11.058                    13.202                    15.615                    18.564                     21.78        
           1.9516                   2.2208                   2.7592                   3.2976                    3.836                   4.6436                   5.4512                    6.528                   7.6049                    9.2201                    11.105                    13.258                    15.681                    18.642                    21.873        
           1.9598                   2.2302                   2.7708                   3.0412                   3.8522                   4.3929                   5.4742                   6.5556                    7.637                     9.259                    11.151                    13.314                    15.747                    18.721                    21.695        
           1.9681                   2.2395                   2.7825                    3.054                   3.8684                   4.4113                   5.4972                   6.5831                    7.669                    9.2979                    10.927                    13.099                    15.813                    18.528                    21.786        
           1.9763                   2.2489                   2.5215                   3.0667                   3.8846                   4.4298                   5.5202                   6.3381                   7.7011                    9.3368                    10.972                    13.153                    15.607                    18.606                    21.877        
           1.9845                   2.2583                    2.532                   3.0795                   3.9008                   4.4483                   5.5432                   6.3645                   7.7332                    9.1019                    11.018                    13.208                    15.672                    18.683                    21.694        
           1.9928                   2.2676                   2.5425                   3.0923                   3.9169                   4.4667                   5.2914                   6.3909                   7.7653                    9.1397                    11.064                    13.263                    15.737                    18.761                    21.784        
            2.001                    2.277                    2.553                   3.1051                   3.6571                   4.4852                   5.3132                   6.4173                   7.7974                    9.1775                     11.11                    13.318                    15.802                    18.562                    21.874        
           2.0092                   2.2864                   2.5635                   3.1179                   3.6722                   4.5036                   5.3351                   6.4437                   7.8295                    9.2153                    11.155                    13.095                     15.59                    18.639                    21.687        
           2.0175                   2.2958                    2.574                   3.1306                   3.6872                   4.5221                    5.357                   6.4701                   7.8616                     9.253                    10.923                    13.149                    15.654                    18.715                    21.776        
           2.0257                   2.3051                   2.5846                   3.1434                   3.7023                   4.5405                   5.3788                   6.4965                   7.6142                    9.2908                    10.967                    13.203                    15.718                    18.512                    21.865        
           1.7534                   2.3145                   2.5951                   3.1562                   3.7173                    4.559                   5.4007                   6.5229                   7.6452                    9.3286                    11.012                    13.256                    15.781                    18.587                    21.673        

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
mt_ev_condi_z_max_bp: I by M
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        3728          15

    mt_ev_condi_z_max_bp1    mt_ev_condi_z_max_bp2    mt_ev_condi_z_max_bp3    mt_ev_condi_z_max_bp4    mt_ev_condi_z_max_bp5    mt_ev_condi_z_max_bp6    mt_ev_condi_z_max_bp7    mt_ev_condi_z_max_bp8    mt_ev_condi_z_max_bp9    mt_ev_condi_z_max_bp10    mt_ev_condi_z_max_bp11    mt_ev_condi_z_max_bp12    mt_ev_condi_z_max_bp13    mt_ev_condi_z_max_bp14    mt_ev_condi_z_max_bp15
    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________

               -20                      -20                      -20                      -20                      -20                      -20                      -20                      -20                      -20                      -20                       -20                       -20                       -20                       -20                       -20        
               -20                      -20                      -20                      -20                      -20                      -20                      -20                      -20                      -20                      -20                       -20                       -20                       -20                       -20                       -20        
           -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                   -19.999                   -19.999                   -19.999                   -19.999                   -19.999        
           -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                   -19.999                   -19.999                   -19.999                   -19.999                   -19.999        
           -19.867                  -19.867                  -19.872                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                   -19.999                   -19.999                   -19.999                   -19.999                   -19.999        
           -19.584                  -19.584                  -19.692                  -19.902                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                  -19.999                   -19.999                   -19.999                   -19.999                   -19.999                   -19.999        
           -19.303                  -19.303                  -19.439                  -19.658                  -19.917                  -19.998                  -19.998                  -19.998                  -19.998                  -19.998                   -19.998                   -19.998                   -19.998                   -19.998                   -19.998        
            -19.02                   -19.02                  -19.171                  -19.394                  -19.998                  -19.998                  -19.998                  -19.998                  -19.998                  -19.998                   -19.998                   -19.998                   -19.998                   -19.998                   -19.998        
           -18.735                  -18.735                  -18.898                  -19.998                  -19.998                  -19.998                  -19.998                  -19.998                  -19.998                  -19.998                   -19.998                   -19.998                   -19.998                   -19.998                   -19.998        
           -18.454                  -18.454                  -18.617                  -19.946                  -19.946                  -19.946                  -19.957                  -19.997                  -19.997                  -19.997                   -19.997                   -19.997                   -19.997                   -19.997                   -19.997        
           -18.168                  -18.168                  -18.339                  -19.668                  -19.668                  -19.668                  -19.668                  -19.986                  -19.997                  -19.997                   -19.997                   -19.997                   -19.997                   -19.997                   -19.997        
           -17.885                  -17.885                   -18.06                  -19.385                  -19.385                  -19.385                  -19.385                   -19.71                  -19.997                  -19.997                   -19.997                   -19.997                   -19.997                   -19.997                   -19.997        
           -17.598                  -17.611                  -17.775                  -19.097                  -19.097                  -19.097                  -19.111                  -19.438                  -19.997                  -19.997                   -19.997                   -19.997                   -19.997                   -19.997                   -19.997        
           -17.324                  -17.324                  -17.501                  -18.815                  -18.815                  -18.815                  -18.815                  -19.996                  -19.996                  -19.996                   -19.996                   -19.996                   -19.996                   -19.996                   -19.996        
           -17.038                  -17.038                  -17.213                  -18.533                  -18.533                  -18.533                  -18.533                  -19.996                  -19.996                  -19.996                   -19.996                   -19.996                   -19.996                   -19.996                   -19.996        
           -16.758                  -16.758                  -16.929                  -18.241                  -18.241                  -18.258                  -18.258                  -19.757                  -19.757                  -19.808                   -19.996                   -19.996                   -19.996                   -19.996                   -19.996        
            -16.47                   -16.47                  -16.651                   -17.96                   -17.96                   -17.96                  -19.468                  -19.468                  -19.468                  -19.523                   -19.995                   -19.995                   -19.995                   -19.995                   -19.995        
           -16.191                  -16.191                  -16.365                  -17.678                  -17.678                  -17.678                  -19.184                  -19.184                  -19.184                  -19.242                   -19.995                   -19.995                   -19.995                   -19.995                   -19.995        
           -15.906                  -15.906                   -16.09                  -17.398                  -17.398                  -17.398                  -18.891                  -18.891                  -18.911                  -19.995                   -19.995                   -19.995                   -19.995                   -19.995                   -19.995        
           -15.614                  -15.635                  -15.808                  -17.103                  -17.124                  -17.124                  -18.613                  -18.613                  -18.613                  -19.995                   -19.995                   -19.995                   -19.995                   -19.995                   -19.995        

    mt_ev_condi_z_max_bp1    mt_ev_condi_z_max_bp2    mt_ev_condi_z_max_bp3    mt_ev_condi_z_max_bp4    mt_ev_condi_z_max_bp5    mt_ev_condi_z_max_bp6    mt_ev_condi_z_max_bp7    mt_ev_condi_z_max_bp8    mt_ev_condi_z_max_bp9    mt_ev_condi_z_max_bp10    mt_ev_condi_z_max_bp11    mt_ev_condi_z_max_bp12    mt_ev_condi_z_max_bp13    mt_ev_condi_z_max_bp14    mt_ev_condi_z_max_bp15
    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    _____________________    ______________________    ______________________    ______________________    ______________________    ______________________    ______________________

           42.738                   42.479                   41.961                   41.443                   40.925                   40.148                   39.112                   38.076                   36.781                    35.486                    33.674                    31.343                    29.012                    25.904                    22.796        
           43.013                   42.753                   42.233                   41.712                   41.192                   40.412                   39.371                   38.331                   37.291                     35.73                    33.909                    31.828                    29.227                    26.366                    22.984        
           43.288                   43.027                   42.504                   41.982                   41.459                   40.676                   39.892                   38.586                   37.541                    35.973                    34.144                    32.054                    29.442                    26.568                    23.433        
           43.563                   43.301                   42.776                   42.251                   41.727                    40.94                   40.152                   39.103                   37.791                    36.217                     34.38                    32.281                    29.657                    26.771                    23.622        
           43.839                   43.575                   43.048                   42.521                   41.994                   41.203                   40.413                   39.359                   38.041                     36.46                    34.615                    32.507                    30.135                    27.237                    24.074        
           44.114                   43.849                    43.32                    42.79                   42.261                   41.467                   40.673                   39.615                   38.291                    36.703                    35.115                    32.733                    30.351                     27.44                    24.264        
           44.389                   44.123                   43.592                    43.06                   42.528                   41.731                   40.934                    39.87                   38.541                    37.212                    35.352                    33.225                    30.568                    27.644                    24.454        
           44.664                   44.397                   43.863                   43.329                   42.796                   41.995                   41.194                   40.126                   38.792                    37.457                    35.588                    33.453                    30.784                    27.847                    24.911        
           44.939                   44.671                   44.135                   43.599                   43.063                   42.259                   41.454                   40.382                   39.042                    37.701                    35.825                     33.68                    31.268                    28.319                    25.102        
           45.214                   44.945                   44.407                   43.868                    43.33                   42.522                   41.715                   40.638                   39.561                    37.946                    36.061                    33.908                    31.485                    28.524                    25.293        
            45.49                   45.219                   44.679                   44.408                   43.597                   43.057                   41.975                   40.894                   39.812                     38.19                    36.298                    34.135                    31.702                    28.729                    25.755        
           45.765                   45.493                    44.95                   44.679                   43.864                   43.321                   42.236                    41.15                   40.064                    38.435                    36.806                    34.634                    31.919                    29.205                    25.947        
            46.04                   45.767                   45.495                   44.949                   44.132                   43.586                   42.496                   41.678                   40.315                    38.679                    37.044                    34.863                    32.409                    29.411                    26.139        
           46.315                   46.041                   45.768                    45.22                   44.399                   43.851                   42.756                   41.935                   40.566                    39.198                    37.281                    35.091                    32.628                    29.617                    26.605        
            46.59                   46.315                    46.04                   45.491                   44.666                   44.116                   43.292                   42.192                   40.818                    39.443                    37.519                     35.32                    32.846                    29.822                    26.799        
           46.865                   46.589                   46.313                   45.761                   45.209                   44.381                   43.553                   42.449                   41.069                    39.689                    37.757                    35.549                    33.064                    30.304                    26.992        
           47.141                   46.863                   46.586                   46.032                   45.478                   44.646                   43.815                   42.706                    41.32                    39.935                    37.994                    36.054                     33.56                    30.511                    27.463        
           47.416                   47.137                   46.859                   46.303                   45.746                   44.911                   44.076                   42.963                   41.572                     40.18                     38.51                    36.284                    33.779                    30.718                    27.657        
           47.691                   47.411                   47.132                   46.573                   46.014                   45.176                   44.338                    43.22                   42.102                    40.426                    38.749                    36.514                    33.999                    31.205                    27.852        
           48.247                   47.686                   47.405                   46.844                   46.283                   45.441                   44.599                   43.477                   42.355                    40.671                    38.988                    36.744                    34.219                    31.413                    28.327        

Graph

if (bl_graph_evf)

Graph 1, V and EV

    if (~bl_graph_onebyones)
        figure('PaperPosition', [0 0 14 4]);
        hold on;
    end


    for subplot_j=1:1:2

        if (~bl_graph_onebyones)
            hAxis(subplot_j) = subplot(1,2,subplot_j);
        else
            figure('PaperPosition', [0 0 7 4]);
        end

        if (subplot_j==1)
            chart = plot(mt_val);
        end
        if (subplot_j==2)
            chart = plot(mt_ev_condi_z);
        end

        clr = jet(numel(chart));
        for m = 1:numel(chart)
            set(chart(m),'Color',clr(m,:))
        end

        legend2plot = fliplr([1 round(numel(chart)/3) round((2*numel(chart))/3)  numel(chart)]);
        legendCell = cellstr(num2str(ar_z', 'shock=%3.2f'));
        legend(chart(legend2plot), legendCell(legend2plot), 'Location','southeast');

        if (subplot_j==1)
            title('V(coh,zp); w(k+b),k,z');
        end
        if (subplot_j==2)
            title('E_z(V(coh,zp|z))');
        end

        ylabel('Next Period Value');
        xlabel({'Index of Cash-on-Hand Discrete Point'...
            'Each Segment is a w=k+b; within segment increasing k'...
            'EV and V identical if shock is fully persistent'});
        grid on;
        grid minor;
    end

    % Share y axis
    if (~bl_graph_onebyones)
        linkaxes(hAxis,'y');
    end

    % save file
    if (bl_img_save)
        mkdir(support_map('st_img_path'));
        st_file_name = [st_img_prefix st_img_name_main '_vev' st_img_suffix];
        saveas(gcf, strcat(st_img_path, st_file_name));
    end

Graph 2, max(EV)

    if(~bl_graph_onebyones)
        figure('PaperPosition', [0 0 7 4]);
    end

    for sub_j=1:1:1

        if(sub_j==1)
            mt_outcome = mt_ev_condi_z_max;
            st_y_label = 'max_{k''}(E(V(coh(k'',b''=w-k''),z''|z,w))';
        end

        if(~bl_graph_onebyones)
            subplot(1,1,sub_j)
        else
            figure('PaperPosition', [0 0 7 4]);
        end
        hold on;

        ar_it_z_graph = ([1 round((it_z_n)/4) round(2*((it_z_n)/4)) round(3*((it_z_n)/4)) (it_z_n)]);
        clr = jet(length(ar_it_z_graph));
        i_ctr = 0;
        for i = ar_it_z_graph
            i_ctr = i_ctr + 1;
            ar_x = ar_w_level_full;
            ar_y = mt_outcome(:, i);
            scatter(ar_x, ar_y, 5, ...
                'MarkerEdgeColor', clr(i_ctr,:), ...
                'MarkerFaceColor', clr(i_ctr,:));
        end

        grid on;
        grid minor;
        title(['2nd Stage Exp Value at Optimal K given W=K''+B'''])
        ylabel(st_y_label)
        xlabel({'Aggregate Savings'})

        legendCell = cellstr(num2str(ar_z', 'shock=%3.2f'));
        legendCell{length(legendCell) + 1} = 'max-agg-save';
        legend(legendCell([ar_it_z_graph length(legendCell)]), 'Location','southeast');

        xline0 = xline(0);
        xline0.HandleVisibility = 'off';
        yline0 = yline(0);
        yline0.HandleVisibility = 'off';

    end

    % save file
    if (bl_img_save)
        mkdir(support_map('st_img_path'));
        st_file_name = [st_img_prefix st_img_name_main '_maxev' st_img_suffix];
        saveas(gcf, strcat(st_img_path, st_file_name));
    end
Warning: Ignoring extra legend entries. 

Graph 3, at max(EV) optimal choice category, color regions, borrow save

    % Borrow Vs Save
    [ar_z_mw, ar_w_mz] = meshgrid(ar_z, ar_w_level_full);
    mt_it_borr_idx = (mt_ev_condi_z_max_bp < 0);
    mt_it_riskyhalf_idx = ((mt_ev_condi_z_max_kp./mt_ev_condi_z_max_bp) > 0.5);
    mt_it_kzero_idx = (mt_ev_condi_z_max_kp == 0);
    mt_it_isnan_idx = (isnan(mt_ev_condi_z_max_kp));

    figure('PaperPosition', [0 0 7 4]);
    % States: ar_w, ar_z
    % Choices: mt_ev_condi_z_max_kp, mt_ev_condi_z_max_bp
    hold on;
    it_sca_size = 10;
    chart_br = scatter(ar_w_mz(mt_it_borr_idx),...
        ar_z_mw(mt_it_borr_idx),...
        it_sca_size, 'blue', 'filled');
    %     legend([chart_br], {'Borrow'}, 'Location','northeast');
    chart_khalf = scatter(ar_w_mz(~mt_it_borr_idx & mt_it_riskyhalf_idx),...
        ar_z_mw(~mt_it_borr_idx & mt_it_riskyhalf_idx),...
        it_sca_size, 'black', 'filled');
    %     legend([chart_khalf], {'Save >0.5 K'}, 'Location','northeast');
    chart_sv = scatter(ar_w_mz(~mt_it_borr_idx & ~mt_it_riskyhalf_idx),...
        ar_z_mw(~mt_it_borr_idx & ~mt_it_riskyhalf_idx),...
        it_sca_size, 'red', 'filled');
    %     legend([chart_sv], {'Save <0.5 K'}, 'Location','northeast');
    chart_invalid = scatter(ar_w_mz(mt_it_kzero_idx | mt_it_isnan_idx),...
        ar_z_mw(mt_it_kzero_idx | mt_it_isnan_idx),...
        it_sca_size, 'yellow', 'filled');
    legend([chart_br, chart_khalf, chart_sv, chart_invalid], ...
        {'Borrow','Save >0.5 K','Save <0.5 K', 'k=0 or k=nan'}, 'Location','northeast');
    title('Borrow and Save Regions')
    ylabel('Shocks')
    xlabel({'Total Savings w=k+b'})
    grid on;

    % save file
    if (bl_img_save)
        mkdir(support_map('st_img_path'));
        st_file_name = [st_img_prefix st_img_name_main '_maxbrsv' st_img_suffix];
        saveas(gcf, strcat(st_img_path, st_file_name));
    end

Graph 4, Optimal K' and B' Levels

compare results here to results from ff_ipwkbz_evf. Several key differences:

  1. Each color line is thicker here, because there is in effect another state that is relevant now in the 2nd stage, which is the cash-on-hand percentage, which is implemented as a percentage of the w = k' + b' choice that needs to go cover bridge loan. So different percentages have the same color, hence thicker lines fore each color
  2. Jump between saving and borrowing, here, the borrowing and savings interest rates differ
  3. Finally, the discontinuities in choices, they occur here because of the formal menu of choices, the little squiggly up and downs are due to households using informal choices to complement formal choices.
    [~, ar_w_mz] = meshgrid(ar_z, ar_w_level_full);
    for sub_j=1:1:4

        if (bl_graph_onebyones)
            figure('PaperPosition', [0 0 7 4]);
        end

        if (sub_j==1)
            if(~bl_graph_onebyones)
                figure('PaperPosition', [0 0 14 4]);
                subplot(1,2,sub_j);
            end
            mt_y = mt_ev_condi_z_max_bp;
        end
        if (sub_j==2)
            if(~bl_graph_onebyones)
                subplot(1,2,sub_j);
            end

            mt_y = mt_ev_condi_z_max_kp;
        end
        if (sub_j==3)
            if(~bl_graph_onebyones)
                figure('PaperPosition', [0 0 14 4]);
                subplot(1,2,sub_j-2);
            end
            mt_y = zeros(size(mt_ev_condi_z_max_bp));
            mt_it_borr_idx = (mt_ev_condi_z_max_bp < 0);
            mt_y(mt_it_borr_idx) = -mt_ev_condi_z_max_bp(mt_it_borr_idx)/fl_b_bd;
            mt_y(~mt_it_borr_idx) = mt_ev_condi_z_max_bp(~mt_it_borr_idx)./ar_w_mz(~mt_it_borr_idx);
        end
        if (sub_j==4)
            if(~bl_graph_onebyones)
                subplot(1,2,sub_j-2);
            end
            mt_y = mt_ev_condi_z_max_kp./(ar_w_level_full'-fl_b_bd);
        end

        hold on;
        clr = jet(length(ar_z));
        for m = 1:length(ar_z)
            chart(m) = scatter(ar_w_level_full, mt_y(:, m), 3, ...
                'Marker', 'O', ...
                'MarkerEdgeColor', clr(m,:), 'MarkerFaceAlpha', 0.75, ...
                'MarkerFaceColor', clr(m,:), 'MarkerEdgeAlpha', 0.75);
        end

        legend2plot = fliplr([1 round(numel(chart)/3) round((2*numel(chart))/3)  numel(chart)]);
        legendCell = cellstr(num2str(ar_z', 'shock=%3.2f'));

        xline0 = xline(0);
        xline0.HandleVisibility = 'off';
        yline0 = yline(0);
        yline0.HandleVisibility = 'off';
        grid on;
        if (sub_j<=2)
            hline = refline([1 0]);
            hline.Color = 'k';
            hline.LineStyle = ':';
            hline.HandleVisibility = 'off';
        end

        if (sub_j==1)
            title('B Choices of W');
            ylabel('B Choices');
            xlabel({'Total Savings w=k+b'});
            legend(chart(legend2plot), legendCell(legend2plot), 'Location','northwest');
        end
        if (sub_j==2)
            title('K Choices of W');
            ylabel('K Choices');
            xlabel({'Total Savings w=k+b'});
            legend(chart(legend2plot), legendCell(legend2plot), 'Location','northwest');
        end

        if (sub_j==3)
            title('B Fraction of Borrow Max and Save');
            ylabel('B/bar(B) if br or B/W if sv');
            xlabel({'Total Savings w=k+b'});
            %             set(gca, 'YScale', 'log');
            ylim([-1.1 1.1]);
            legend(chart(legend2plot), legendCell(legend2plot), 'Location','northwest');
        end
        if (sub_j==4)
            title('K Fraction Choices of Total K Possible');
            ylabel('K/(W-bar(b)) ');
            xlabel({'Total Savings w=k+b'});
            %             set(gca, 'YScale', 'log');
            ylim([0 1.1]);
            legend(chart(legend2plot), legendCell(legend2plot), 'Location','northeast');
        end

    end

    % save file
    if (bl_img_save)
        mkdir(support_map('st_img_path'));
        st_file_name = [st_img_prefix st_img_name_main '_wkbopti' st_img_suffix];
        saveas(gcf, strcat(st_img_path, st_file_name));
    end
end

Display Various Containers

if (bl_display_evf)

Display 1 support_map

    fft_container_map_display(support_map, it_display_summmat_rowmax, it_display_summmat_colmax);
----------------------------------------
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin: Show all key and value pairs from container
CONTAINER NAME: SUPPORT_MAP
----------------------------------------
  Map with properties:

        Count: 43
      KeyType: char
    ValueType: any

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 1 ; key = bl_display ; val = false
pos = 2 ; key = bl_display_defparam ; val = true
pos = 3 ; key = bl_display_dist ; val = false
pos = 4 ; key = bl_display_evf ; val = true
pos = 5 ; key = bl_display_final ; val = true
pos = 6 ; key = bl_display_final_dist ; val = false
pos = 7 ; key = bl_display_final_dist_detail ; val = false
pos = 8 ; key = bl_display_funcgrids ; val = false
pos = 9 ; key = bl_display_minccost ; val = false
pos = 10 ; key = bl_graph ; val = true
pos = 11 ; key = bl_graph_coh_t_coh ; val = true
pos = 12 ; key = bl_graph_evf ; val = true
pos = 13 ; key = bl_graph_funcgrids ; val = false
pos = 14 ; key = bl_graph_funcgrids_detail ; val = false
pos = 15 ; key = bl_graph_onebyones ; val = true
pos = 16 ; key = bl_graph_pol_lvl ; val = true
pos = 17 ; key = bl_graph_pol_pct ; val = true
pos = 18 ; key = bl_graph_val ; val = true
pos = 19 ; key = bl_img_save ; val = false
pos = 20 ; key = bl_mat ; val = false
pos = 21 ; key = bl_post ; val = true
pos = 22 ; key = bl_profile ; val = false
pos = 23 ; key = bl_profile_dist ; val = false
pos = 24 ; key = bl_time ; val = false
pos = 25 ; key = it_display_every ; val = 5
pos = 26 ; key = it_display_final_colmax ; val = 12
pos = 27 ; key = it_display_final_rowmax ; val = 100
pos = 28 ; key = it_display_summmat_colmax ; val = 5
pos = 29 ; key = it_display_summmat_rowmax ; val = 5
pos = 30 ; key = st_img_name_main ; val = _default
pos = 31 ; key = st_img_path ; val = C:/Users/fan/CodeDynaAsset//m_fibs//m_ipwkbz_solve/img/
pos = 32 ; key = st_img_prefix ; val = 
pos = 33 ; key = st_img_suffix ; val = _p4.png
pos = 34 ; key = st_mat_name_main ; val = _default
pos = 35 ; key = st_mat_path ; val = C:/Users/fan/CodeDynaAsset//m_fibs//m_ipwkbz_solve/mat/
pos = 36 ; key = st_mat_prefix ; val = 
pos = 37 ; key = st_mat_suffix ; val = _p4
pos = 38 ; key = st_matimg_path_root ; val = C:/Users/fan/CodeDynaAsset//m_fibs/
pos = 39 ; key = st_profile_name_main ; val = _default
pos = 40 ; key = st_profile_path ; val = C:/Users/fan/CodeDynaAsset//m_fibs//m_ipwkbz_solve/profile/
pos = 41 ; key = st_profile_prefix ; val = 
pos = 42 ; key = st_profile_suffix ; val = _p4
pos = 43 ; key = st_title_prefix ; val = 
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scalars in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                                    i     idx    value
                                    __    ___    _____

    bl_display                       1     1       0  
    bl_display_defparam              2     2       1  
    bl_display_dist                  3     3       0  
    bl_display_evf                   4     4       1  
    bl_display_final                 5     5       1  
    bl_display_final_dist            6     6       0  
    bl_display_final_dist_detail     7     7       0  
    bl_display_funcgrids             8     8       0  
    bl_display_minccost              9     9       0  
    bl_graph                        10    10       1  
    bl_graph_coh_t_coh              11    11       1  
    bl_graph_evf                    12    12       1  
    bl_graph_funcgrids              13    13       0  
    bl_graph_funcgrids_detail       14    14       0  
    bl_graph_onebyones              15    15       1  
    bl_graph_pol_lvl                16    16       1  
    bl_graph_pol_pct                17    17       1  
    bl_graph_val                    18    18       1  
    bl_img_save                     19    19       0  
    bl_mat                          20    20       0  
    bl_post                         21    21       1  
    bl_profile                      22    22       0  
    bl_profile_dist                 23    23       0  
    bl_time                         24    24       0  
    it_display_every                25    25       1  
    it_display_final_colmax         26    26       1  
    it_display_final_rowmax         27    27       1  
    it_display_summmat_colmax       28    28       1  
    it_display_summmat_rowmax       29    29       1  

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Strings in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                            i     idx
                            __    ___

    st_img_name_main         1    30 
    st_img_path              2    31 
    st_img_prefix            3    32 
    st_img_suffix            4    33 
    st_mat_name_main         5    34 
    st_mat_path              6    35 
    st_mat_prefix            7    36 
    st_mat_suffix            8    37 
    st_matimg_path_root      9    38 
    st_profile_name_main    10    39 
    st_profile_path         11    40 
    st_profile_prefix       12    41 
    st_profile_suffix       13    42 
    st_title_prefix         14    43 

Display 2 armt_map

    fft_container_map_display(armt_map, it_display_summmat_rowmax, it_display_summmat_colmax);
----------------------------------------
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin: Show all key and value pairs from container
CONTAINER NAME: ARMT_MAP
----------------------------------------
  Map with properties:

        Count: 29
      KeyType: char
    ValueType: any

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 1 ; key = ar_a_meshk ;rown= 932000 ,coln= 1
ar_a_meshk :mu= -14.2049 ,sd= 6.6272 ,min= -20 ,max= 49.93
                         zi_1_c1
                         _______

    zi_1_R1                  -20
    zi_2_R2                  -20
    zi_466000_r466000    -19.995
    zi_931999_r931999    -19.649
    zi_932000_r932000     -19.93

pos = 2 ; key = ar_ak_perc ;rown= 1 ,coln= 250
ar_ak_perc :mu= 0.5 ,sd= 0.28983 ,min= 0.001 ,max= 0.999
               zi_1_C1    zi_2_C2     zi_125_c125    zi_249_c249    zi_250_c250
               _______    ________    ___________    ___________    ___________

    zi_1_r1     0.001     0.005008       0.498         0.99499         0.999   

pos = 3 ; key = ar_ameshk_tnext_with_r ;rown= 932000 ,coln= 1
ar_ameshk_tnext_with_r :mu= -15.3138 ,sd= 7.0388 ,min= -21.9 ,max= 51.1782
                         zi_1_c1
                         _______

    zi_1_R1                -21.9
    zi_2_R2                -21.9
    zi_466000_r466000    -21.574
    zi_931999_r931999    -20.946
    zi_932000_r932000    -21.253

pos = 4 ; key = ar_coh_bridge_perc ;rown= 1 ,coln= 50
ar_coh_bridge_perc :mu= 0.5 ,sd= 0.2975 ,min= 0 ,max= 1
               zi_1_C1    zi_2_C2     zi_25_c25    zi_49_c49    zi_50_c50
               _______    ________    _________    _________    _________

    zi_1_r1       0       0.020408     0.4898       0.97959         1    

pos = 5 ; key = ar_forbrblk ;rown= 1 ,coln= 9
ar_forbrblk :mu= -7.0556 ,sd= 6.3809 ,min= -19 ,max= 0
               zi_1_c1    zi_2_c2    zi_5_c5    zi_8_c8    zi_9_c9
               _______    _______    _______    _______    _______

    zi_1_r1      -19       -14.5      -5.5        -1          0   

pos = 6 ; key = ar_forbrblk_r ;rown= 1 ,coln= 9
ar_forbrblk_r :mu= 0.065 ,sd= 0 ,min= 0.065 ,max= 0.065
               zi_1_c1    zi_2_c2    zi_5_c5    zi_8_c8    zi_9_c9
               _______    _______    _______    _______    _______

    zi_1_r1     0.065      0.065      0.065      0.065      0.065 

pos = 7 ; key = ar_interp_c_grid ;rown= 1 ,coln= 772572
ar_interp_c_grid :mu= 38.6486 ,sd= 22.3023 ,min= 0.02 ,max= 77.2773
               zi_1_C1    zi_2_C2    zi_386286_c386286    zi_772571_c772571    zi_772572_c772572
               _______    _______    _________________    _________________    _________________

    zi_1_r1     0.02      0.0201          38.649               77.277               77.277      

pos = 8 ; key = ar_interp_coh_grid ;rown= 1 ,coln= 772
ar_interp_coh_grid :mu= 18.6145 ,sd= 22.347 ,min= -20 ,max= 57.2773
               zi_1_C1    zi_2_C2    zi_386_c386    zi_771_c771    zi_772_c772
               _______    _______    ___________    ___________    ___________

    zi_1_r1      -20       -19.9       18.538         57.177         57.277   

pos = 9 ; key = ar_k_mesha ;rown= 932000 ,coln= 1
ar_k_mesha :mu= 5.7951 ,sd= 6.6272 ,min= 0 ,max= 69.93
                         zi_1_c1
                         _______

    zi_1_R1                   0 
    zi_2_R2                   0 
    zi_466000_r466000     4.813 
    zi_931999_r931999    69.649 
    zi_932000_r932000     69.93 

pos = 10 ; key = ar_stationary ;rown= 1 ,coln= 15
ar_stationary :mu= 0.066667 ,sd= 0.060897 ,min= 0.0027089 ,max= 0.16757
                zi_1_C1      zi_2_C2     zi_8_C8    zi_14_c14    zi_15_c15
               _________    _________    _______    _________    _________

    zi_1_r1    0.0027089    0.0069499    0.16757    0.0069499    0.0027089

pos = 11 ; key = ar_w_level ;rown= 1 ,coln= 249
ar_w_level :mu= 14.9398 ,sd= 20.3112 ,min= -20 ,max= 50
               zi_1_C1    zi_2_C2    zi_125_c125    zi_248_c248    zi_249_c249
               _______    _______    ___________    ___________    ___________

    zi_1_r1      -20      -19.717      14.858         49.717           50     

pos = 12 ; key = ar_w_level_full ;rown= 1 ,coln= 3728
ar_w_level_full :mu= -8.4098 ,sd= 9.898 ,min= -20 ,max= 50
               zi_1_C1    zi_2_C2    zi_1864_c1864    zi_3727_c3727    zi_3728_c3728
               _______    _______    _____________    _____________    _____________

    zi_1_r1      -20      -19.717       -15.182          49.717             50      

pos = 13 ; key = ar_w_perc ;rown= 1 ,coln= 50
ar_w_perc :mu= 0.5 ,sd= 0.2969 ,min= 0.001 ,max= 0.999
               zi_1_C1    zi_2_C2     zi_25_c25    zi_49_c49    zi_50_c50
               _______    ________    _________    _________    _________

    zi_1_r1     0.001     0.021367     0.48982      0.97863       0.999  

pos = 14 ; key = ar_z ;rown= 1 ,coln= 15
ar_z :mu= 1.1347 ,sd= 0.69878 ,min= 0.34741 ,max= 2.567
               zi_1_C1    zi_2_C2    zi_8_C8    zi_14_c14    zi_15_c15
               _______    _______    _______    _________    _________

    zi_1_r1    0.34741    0.40076    0.94436     2.2253        2.567  

pos = 15 ; key = it_ameshk_n ; val = 932000
pos = 16 ; key = mt_bl_w_by_interp_coh_interp_grid_wneg ;rown= 50 ,coln= 772
mt_bl_w_by_interp_coh_interp_grid_wneg :mu= 0.60951 ,sd= 0.48787 ,min= 0 ,max= 1
                 zi_1_C1    zi_2_C2    zi_386_c386    zi_771_c771    zi_772_c772
                 _______    _______    ___________    ___________    ___________

    zi_1_R1       true       true         true           true           true    
    zi_2_R2       true       true         true           true           true    
    zi_25_r25     true       true         true           false          false   
    zi_49_r49     true       true         false          false          false   
    zi_50_r50     true       true         false          false          false   

pos = 17 ; key = mt_coh_bridge_perc_mesh_w_level_neg ;rown= 71 ,coln= 50
mt_coh_bridge_perc_mesh_w_level_neg :mu= 0.5 ,sd= 0.29455 ,min= 0 ,max= 1
                 zi_1_C1    zi_2_C2     zi_25_c25    zi_49_c49    zi_50_c50
                 _______    ________    _________    _________    _________

    zi_1_R1         0       0.020408     0.4898       0.97959         1    
    zi_2_R2         0       0.020408     0.4898       0.97959         1    
    zi_36_r36       0       0.020408     0.4898       0.97959         1    
    zi_70_r70       0       0.020408     0.4898       0.97959         1    
    zi_71_r71       0       0.020408     0.4898       0.97959         1    

pos = 18 ; key = mt_coh_w_perc_ratio_wneg ;rown= 23527 ,coln= 1
mt_coh_w_perc_ratio_wneg :mu= 0.72495 ,sd= 0.37217 ,min= 0 ,max= 1
                       zi_1_c1
                       _______

    zi_1_R1               0   
    zi_2_R2               0   
    zi_11764_r11764       1   
    zi_23526_r23526       1   
    zi_23527_r23527       1   

pos = 19 ; key = mt_coh_wkb ;rown= 932000 ,coln= 15
mt_coh_wkb :mu= -7.6819 ,sd= 10.4517 ,min= -21.4564 ,max= 57.2773
                         zi_1_C1    zi_2_C2    zi_8_C8    zi_14_c14    zi_15_c15
                         _______    _______    _______    _________    _________

    zi_1_R1              -21.456    -21.456    -21.456     -21.456      -21.456 
    zi_2_R2              -21.456    -21.456    -21.456     -21.456      -21.456 
    zi_466000_r466000    -16.091    -15.997     -15.04     -12.784      -12.183 
    zi_931999_r931999     45.176     45.421     47.926      53.828       55.402 
    zi_932000_r932000     45.129     45.375     47.883      53.793        55.37 

pos = 20 ; key = mt_interp_coh_grid_mesh_w_perc ;rown= 50 ,coln= 772
mt_interp_coh_grid_mesh_w_perc :mu= 18.6145 ,sd= 22.3329 ,min= -20 ,max= 57.2773
                 zi_1_C1    zi_2_C2    zi_386_c386    zi_771_c771    zi_772_c772
                 _______    _______    ___________    ___________    ___________

    zi_1_R1        -20       -19.9       18.538         57.177         57.277   
    zi_2_R2        -20       -19.9       18.538         57.177         57.277   
    zi_25_r25      -20       -19.9       18.538         57.177         57.277   
    zi_49_r49      -20       -19.9       18.538         57.177         57.277   
    zi_50_r50      -20       -19.9       18.538         57.177         57.277   

pos = 21 ; key = mt_interp_coh_grid_mesh_z ;rown= 772 ,coln= 15
mt_interp_coh_grid_mesh_z :mu= 18.6145 ,sd= 22.3335 ,min= -20 ,max= 57.2773
                   zi_1_C1    zi_2_C2    zi_8_C8    zi_14_c14    zi_15_c15
                   _______    _______    _______    _________    _________

    zi_1_R1           -20        -20        -20         -20          -20  
    zi_2_R2         -19.9      -19.9      -19.9       -19.9        -19.9  
    zi_386_r386    18.538     18.538     18.538      18.538       18.538  
    zi_771_r771    57.177     57.177     57.177      57.177       57.177  
    zi_772_r772    57.277     57.277     57.277      57.277       57.277  

pos = 22 ; key = mt_k ;rown= 250 ,coln= 3728
mt_k :mu= 5.7951 ,sd= 6.6272 ,min= 0 ,max= 69.93
                   zi_1_C1     zi_2_C2     zi_1864_c1864    zi_3727_c3727    zi_3728_c3728
                   _______    _________    _____________    _____________    _____________

    zi_1_R1           0       0.0002834      0.0048178        0.069717             0.07   
    zi_2_R2           0       0.0014193       0.024128         0.34914          0.35056   
    zi_125_r125       0         0.14113         2.3993          34.719            34.86   
    zi_249_r249       0         0.28198         4.7937          69.367           69.649   
    zi_250_r250       0         0.28312          4.813          69.647            69.93   

pos = 23 ; key = mt_w_by_interp_coh_interp_grid ;rown= 50 ,coln= 772
mt_w_by_interp_coh_interp_grid :mu= -0.69276 ,sd= 17.2218 ,min= -20 ,max= 57.2
                 zi_1_C1    zi_2_C2    zi_386_c386    zi_771_c771    zi_772_c772
                 _______    _______    ___________    ___________    ___________

    zi_1_R1        -20          -20      -19.961        -19.923        -19.923  
    zi_2_R2        -20      -19.998      -19.177        -18.351        -18.349  
    zi_25_r25      -20      -19.951      -1.1233         17.803         17.852  
    zi_49_r49      -20      -19.902       17.715         55.528         55.626  
    zi_50_r50      -20        -19.9         18.5           57.1           57.2  

pos = 24 ; key = mt_w_by_interp_coh_interp_grid_wneg ;rown= 23527 ,coln= 1
mt_w_by_interp_coh_interp_grid_wneg :mu= -12.2397 ,sd= 5.8332 ,min= -20 ,max= -0.0009157
                       zi_1_c1
                       _______

    zi_1_R1                -20
    zi_2_R2                -20
    zi_11764_r11764     -4.474
    zi_23526_r23526    -2.6095
    zi_23527_r23527    -1.0355

pos = 25 ; key = mt_w_by_interp_coh_interp_grid_wpos ;rown= 15073 ,coln= 1
mt_w_by_interp_coh_interp_grid_wpos :mu= 17.3305 ,sd= 13.1706 ,min= 0.0036271 ,max= 57.2
                       zi_1_c1 
                       ________

    zi_1_R1            0.051943
    zi_2_R2              0.1522
    zi_7537_R7537        13.967
    zi_15072_r15072      55.626
    zi_15073_r15073        57.2

pos = 26 ; key = mt_w_level_neg_mesh_coh_bridge_perc ;rown= 71 ,coln= 50
mt_w_level_neg_mesh_coh_bridge_perc :mu= -10.081 ,sd= 5.8088 ,min= -20 ,max= -0.16194
                 zi_1_C1     zi_2_C2     zi_25_c25    zi_49_c49    zi_50_c50
                 ________    ________    _________    _________    _________

    zi_1_R1           -20         -20         -20          -20          -20 
    zi_2_R2       -19.717     -19.717     -19.717      -19.717      -19.717 
    zi_36_r36     -10.081     -10.081     -10.081      -10.081      -10.081 
    zi_70_r70    -0.44534    -0.44534    -0.44534     -0.44534     -0.44534 
    zi_71_r71    -0.16194    -0.16194    -0.16194     -0.16194     -0.16194 

pos = 27 ; key = mt_z_mesh_coh_interp_grid ;rown= 772 ,coln= 15
mt_z_mesh_coh_interp_grid :mu= 1.1347 ,sd= 0.67511 ,min= 0.34741 ,max= 2.567
                   zi_1_C1    zi_2_C2    zi_8_C8    zi_14_c14    zi_15_c15
                   _______    _______    _______    _________    _________

    zi_1_R1        0.34741    0.40076    0.94436     2.2253        2.567  
    zi_2_R2        0.34741    0.40076    0.94436     2.2253        2.567  
    zi_386_r386    0.34741    0.40076    0.94436     2.2253        2.567  
    zi_771_r771    0.34741    0.40076    0.94436     2.2253        2.567  
    zi_772_r772    0.34741    0.40076    0.94436     2.2253        2.567  

pos = 28 ; key = mt_z_mesh_coh_wkb ;rown= 932000 ,coln= 15
mt_z_mesh_coh_wkb :mu= 1.1347 ,sd= 0.67508 ,min= 0.34741 ,max= 2.567
                         zi_1_C1    zi_2_C2    zi_8_C8    zi_14_c14    zi_15_c15
                         _______    _______    _______    _________    _________

    zi_1_R1              0.34741    0.40076    0.94436     2.2253        2.567  
    zi_2_R2              0.34741    0.40076    0.94436     2.2253        2.567  
    zi_466000_r466000    0.34741    0.40076    0.94436     2.2253        2.567  
    zi_931999_r931999    0.34741    0.40076    0.94436     2.2253        2.567  
    zi_932000_r932000    0.34741    0.40076    0.94436     2.2253        2.567  

pos = 29 ; key = mt_z_trans ;rown= 15 ,coln= 15
mt_z_trans :mu= 0.066667 ,sd= 0.095337 ,min= 0 ,max= 0.27902
                  zi_1_C1       zi_2_C2       zi_8_C8      zi_14_c14     zi_15_c15 
                 __________    __________    __________    __________    __________

    zi_1_R1         0.26016       0.26831    0.00012823    1.1102e-15             0
    zi_2_R2         0.11232       0.19622    0.00098855    9.3592e-14    3.3307e-16
    zi_8_R8      1.7181e-06    4.1008e-05       0.27902    4.1008e-05    1.7181e-06
    zi_14_r14     3.474e-16    9.3597e-14    0.00098855       0.19622       0.11232
    zi_15_r15    2.7412e-18    1.1057e-15    0.00012823       0.26831       0.26016

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Matrix in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                                              i     idx      rowN         colN         mean        std          min          max    
                                              __    ___    ________    __________    ________    ________    _________    __________

    ar_a_meshk                                 1     1     9.32e+05             1     -14.205      6.6272          -20         49.93
    ar_ak_perc                                 2     2            1           250         0.5     0.28983        0.001         0.999
    ar_ameshk_tnext_with_r                     3     3     9.32e+05             1     -15.314      7.0388        -21.9        51.178
    ar_coh_bridge_perc                         4     4            1            50         0.5      0.2975            0             1
    ar_forbrblk                                5     5            1             9     -7.0556      6.3809          -19             0
    ar_forbrblk_r                              6     6            1             9       0.065           0        0.065         0.065
    ar_interp_c_grid                           7     7            1    7.7257e+05      38.649      22.302         0.02        77.277
    ar_interp_coh_grid                         8     8            1           772      18.614      22.347          -20        57.277
    ar_k_mesha                                 9     9     9.32e+05             1      5.7951      6.6272            0         69.93
    ar_stationary                             10    10            1            15    0.066667    0.060897    0.0027089       0.16757
    ar_w_level                                11    11            1           249       14.94      20.311          -20            50
    ar_w_level_full                           12    12            1          3728     -8.4098       9.898          -20            50
    ar_w_perc                                 13    13            1            50         0.5      0.2969        0.001         0.999
    ar_z                                      14    14            1            15      1.1347     0.69878      0.34741         2.567
    mt_bl_w_by_interp_coh_interp_grid_wneg    15    16           50           772     0.60951     0.48787            0             1
    mt_coh_bridge_perc_mesh_w_level_neg       16    17           71            50         0.5     0.29455            0             1
    mt_coh_w_perc_ratio_wneg                  17    18        23527             1     0.72495     0.37217            0             1
    mt_coh_wkb                                18    19     9.32e+05            15     -7.6819      10.452      -21.456        57.277
    mt_interp_coh_grid_mesh_w_perc            19    20           50           772      18.614      22.333          -20        57.277
    mt_interp_coh_grid_mesh_z                 20    21          772            15      18.614      22.334          -20        57.277
    mt_k                                      21    22          250          3728      5.7951      6.6272            0         69.93
    mt_w_by_interp_coh_interp_grid            22    23           50           772    -0.69276      17.222          -20          57.2
    mt_w_by_interp_coh_interp_grid_wneg       23    24        23527             1      -12.24      5.8332          -20    -0.0009157
    mt_w_by_interp_coh_interp_grid_wpos       24    25        15073             1       17.33      13.171    0.0036271          57.2
    mt_w_level_neg_mesh_coh_bridge_perc       25    26           71            50     -10.081      5.8088          -20      -0.16194
    mt_z_mesh_coh_interp_grid                 26    27          772            15      1.1347     0.67511      0.34741         2.567
    mt_z_mesh_coh_wkb                         27    28     9.32e+05            15      1.1347     0.67508      0.34741         2.567
    mt_z_trans                                28    29           15            15    0.066667    0.095337            0       0.27902

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scalars in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                   i    idx     value  
                   _    ___    ________

    it_ameshk_n    1    15     9.32e+05

Display 3 param_map

    fft_container_map_display(param_map, it_display_summmat_rowmax, it_display_summmat_colmax);
----------------------------------------
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin: Show all key and value pairs from container
CONTAINER NAME: PARAM_MAP
----------------------------------------
  Map with properties:

        Count: 43
      KeyType: char
    ValueType: any

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 1 ; key = bl_b_is_principle ; val = true
pos = 2 ; key = bl_bridge ; val = true
pos = 3 ; key = bl_default ; val = true
pos = 4 ; key = bl_rollover ; val = true
pos = 5 ; key = fl_Amean ; val = 1
pos = 6 ; key = fl_alpha ; val = 0.36
pos = 7 ; key = fl_b_bd ; val = -20
pos = 8 ; key = fl_beta ; val = 0.94
pos = 9 ; key = fl_c_min ; val = 0.02
pos = 10 ; key = fl_coh_interp_grid_gap ; val = 0.1
pos = 11 ; key = fl_crra ; val = 1.5
pos = 12 ; key = fl_default_wprime ; val = 0
pos = 13 ; key = fl_delta ; val = 0.08
pos = 14 ; key = fl_forbrblk_brleast ; val = -1
pos = 15 ; key = fl_forbrblk_brmost ; val = -19
pos = 16 ; key = fl_forbrblk_gap ; val = -1.5
pos = 17 ; key = fl_k_max ; val = 70
pos = 18 ; key = fl_k_min ; val = 0
pos = 19 ; key = fl_nan_replace ; val = -9999
pos = 20 ; key = fl_r_fbr ; val = 0.065
pos = 21 ; key = fl_r_fsv ; val = 0.025
pos = 22 ; key = fl_r_inf ; val = 0.095
pos = 23 ; key = fl_tol_dist ; val = 1e-05
pos = 24 ; key = fl_tol_pol ; val = 1e-05
pos = 25 ; key = fl_tol_val ; val = 1e-05
pos = 26 ; key = fl_w ; val = 0.44365
pos = 27 ; key = fl_w_interp_grid_gap ; val = 0.28
pos = 28 ; key = fl_w_max ; val = 50
pos = 29 ; key = fl_w_min ; val = -20
pos = 30 ; key = fl_z_mu ; val = 0
pos = 31 ; key = fl_z_rho ; val = 0.8
pos = 32 ; key = fl_z_sig ; val = 0.2
pos = 33 ; key = it_ak_perc_n ; val = 250
pos = 34 ; key = it_c_interp_grid_gap ; val = 0.0001
pos = 35 ; key = it_coh_bridge_perc_n ; val = 50
pos = 36 ; key = it_maxiter_dist ; val = 1000
pos = 37 ; key = it_maxiter_val ; val = 250
pos = 38 ; key = it_tol_pol_nochange ; val = 25
pos = 39 ; key = it_w_perc_n ; val = 50
pos = 40 ; key = it_z_n ; val = 15
pos = 41 ; key = st_analytical_stationary_type ; val = eigenvector
pos = 42 ; key = st_forbrblk_type ; val = seg3
pos = 43 ; key = st_model ; val = ipwkbz_fibs
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scalars in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                              i     idx    value
                              __    ___    _____

    bl_b_is_principle          1     1       1  
    bl_bridge                  2     2       1  
    bl_default                 3     3       1  
    bl_rollover                4     4       1  
    fl_Amean                   5     5       1  
    fl_alpha                   6     6       1  
    fl_b_bd                    7     7       1  
    fl_beta                    8     8       1  
    fl_c_min                   9     9       1  
    fl_coh_interp_grid_gap    10    10       1  
    fl_crra                   11    11       1  
    fl_default_wprime         12    12       0  
    fl_delta                  13    13       1  
    fl_forbrblk_brleast       14    14       1  
    fl_forbrblk_brmost        15    15       1  
    fl_forbrblk_gap           16    16       1  
    fl_k_max                  17    17       1  
    fl_k_min                  18    18       0  
    fl_nan_replace            19    19       1  
    fl_r_fbr                  20    20       1  
    fl_r_fsv                  21    21       1  
    fl_r_inf                  22    22       1  
    fl_tol_dist               23    23       1  
    fl_tol_pol                24    24       1  
    fl_tol_val                25    25       1  
    fl_w                      26    26       1  
    fl_w_interp_grid_gap      27    27       1  
    fl_w_max                  28    28       1  
    fl_w_min                  29    29       1  
    fl_z_mu                   30    30       0  
    fl_z_rho                  31    31       1  
    fl_z_sig                  32    32       1  
    it_ak_perc_n              33    33       1  
    it_c_interp_grid_gap      34    34       1  
    it_coh_bridge_perc_n      35    35       1  
    it_maxiter_dist           36    36       1  
    it_maxiter_val            37    37       1  
    it_tol_pol_nochange       38    38       1  
    it_w_perc_n               39    39       1  
    it_z_n                    40    40       1  

----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Strings in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                                     i    idx
                                     _    ___

    st_analytical_stationary_type    1    41 
    st_forbrblk_type                 2    42 
    st_model                         3    43 

Display 4 func_map

    fft_container_map_display(func_map, it_display_summmat_rowmax, it_display_summmat_colmax);
----------------------------------------
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Begin: Show all key and value pairs from container
CONTAINER NAME: FUNC_MAP
----------------------------------------
  Map with properties:

        Count: 9
      KeyType: char
    ValueType: any

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
----------------------------------------
----------------------------------------
pos = 1 ; key = f_coh ; val = @(z,b_with_r,k)(f_prod(z,k)+k*(1-fl_delta)+fl_w+b_with_r)
pos = 2 ; key = f_coh_fbis ; val = @(fl_r_inf,ar_for_borr,ar_inf_borr,ar_for_save)(ar_for_borr.*(1+fl_r_fbr)+ar_inf_borr.*(1+fl_r_inf)+ar_for_save.*(1+fl_r_fsv))
pos = 3 ; key = f_coh_save ; val = @(b)(b.*(1+fl_r_fsv))
pos = 4 ; key = f_cons ; val = @(coh,bprime,kprime)(coh-kprime-bprime)
pos = 5 ; key = f_inc ; val = @(z,k,fl_r_inf,ar_for_borr,ar_inf_borr,ar_for_save)(f_prod(z,k)-(fl_delta)*k+fl_w+(ar_for_borr.*(fl_r_fbr)+ar_inf_borr.*(fl_r_inf)+ar_for_save.*(fl_r_fsv)))
pos = 6 ; key = f_prod ; val = @(z,k)((fl_Amean.*(z)).*(k.^(fl_alpha)))
pos = 7 ; key = f_util_crra ; val = @(c)(((c).^(1-fl_crra)-1)./(1-fl_crra))
pos = 8 ; key = f_util_log ; val = @(c)log(c)
pos = 9 ; key = f_util_standin ; val = @(z,b,k)f_util_log((f_coh(z,b,k)-fl_b_bd).*((f_coh(z,b,k)-fl_b_bd)>fl_c_min)+fl_c_min.*((f_coh(z,b,k)-fl_b_bd)<=fl_c_min))
----------------------------------------
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scalars in Container and Sizes and Basic Statistics
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                      i    idx    xFunction
                      _    ___    _________

    f_coh             1     1         1    
    f_coh_fbis        2     2         2    
    f_coh_save        3     3         3    
    f_cons            4     4         4    
    f_inc             5     5         5    
    f_prod            6     6         6    
    f_util_crra       7     7         7    
    f_util_log        8     8         8    
    f_util_standin    9     9         9    

end
end