Loop in Value Iteration Unrecognized by MATLAB
1 次查看(过去 30 天)
显示 更早的评论
I am trying to solve a value iteration problem. I have a matrix, EV, with two columns which must be estimated seperately. However, my loop doesn't work and doesn't allow me to iterate past the initial guess value. Basically, nothing past comand "while" works. MATLAB doesn't return an error or anything, it just doesn't do anything.
%Algorithm
EV0 = zeros(90,2); %Guess initial value of 0.
EV0_0 = EV0(:,1); %Column where i =0.
EV0_1 = EV0(:,2); %Column where i=1.
V = log(exp(u_0 + beta*EV0_0) + exp(u_1 + beta*EV0_1));
EV1_1 = P1*V;
EV1_0 = P0*V;
EV1 = [EV1_0 EV1_1];
while abs(EV1 - EV0) > 0.01 % continue to iterate until convergence is achieved
EV0 = EV1;
EV0_0 = EV0(:,1); %Column where i =0.
EV0_1 = EV0(:,2); %Column where i=1.
V = log(exp(u_0 + beta*EV0_0) + exp(u_1 + beta*EV0_1));
EV1_1 = P1*V;
EV1_0 = P0*V;
EV1 = [EV1_0 EV1_1];
end
Any help to understand how exactly I can get the loop to work would be greatly appreciated!
2 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!