clc; clear; close all; %global beta delta alpha cplusKp Kbarfix pr Vold K count; beta = 0.99; delta = 0.025; alpha = 0.36; tolerance=.01; maxits=300; lowbnd=0.01; upbnd = 25; pr = [0.8507 0.1229 0.5833 0.0938 0.1159 0.8361 0.0313 0.3500 0.0243 0.0021 0.2917 0.0313 0.0091 0.0389 0.0938 0.5250]'; nK=300; %number of indicies in our state space K = zeros(1,nK)'; %populating the state space so that number of possible for i = 1:nK+1; %workers is a function of (1-delta). This way we ensure K(i) = 25*(1-delta)^(nK+1 - i); %that we are in the state space in the following period end; nKbar=10; Kbar = (1:1:nKbar); %Kprime(i,j)= K(I); Vold=ones(nKbar,nK+1,4); %Starting values of value function %Notice the updated value function will only have ONE maximand for each %state combination. That's why the second dimension is just 1. Vnew=ones(nKbar,nK+1,4); %Will update after each iteration %EVold=0; %order V(Kbar,K,z,e) %Vtemp=zeros(nKbar,nK,4); %will popolate with values for each choice dif=1; its=0; %loop for a given good state, employed ltilda=1; lbar=.99*1; %in good state so unemp is 1% e = [1 0]; z = [1.01 .99]; while dif>tolerance && its