How to use a matrix element to define a changing variable
조회 수: 4 (최근 30일)
이전 댓글 표시
So I'm writing a stochastic dynamic program on decision-making based on two informational states about 2 patches to forage in. So the observer can watch a demonstrator and update an informational state on the quality of a patch. The probability of going to patch 1, p, is based on the difference between the info state of patch 1 and info state of patch 2, which changes with every time step. How do I make sure that it's calling the right numbers to compare?
The probability of going to a patch is dependent on an element in a matrix that I've made (i.e. info on patch 1<patch 2 go to patch 1 with 10%prob, info on patch 1>patch 2 go to patch 1 with 90%prob, info on patch 1=patch 2 go to patch 1 with 50%prob)
I have a matrix full of the differences between all possible values and I'm trying to use a specific element of the matrix to give this 'p' variable a value. I'm basically trying to write "if the element of matrix M, depending on the current value of z and y (that are modified by an equation), is greater than 0, then p = 0.9"
Does this make sense? p is dependent on the matrix element, but the matrix element depends on the specific fitness equation chunk it's being used for
for tt=19:-1:1
for j=1:15
for k=1:15
for i=info
if M(j,k)>0
p(j,k)==0.9;
elseif M(j,k)<0
p(j,k)==0.1;
elseif M(j,k)==0
p(j,k)==0.5;
end
Fd(i,j,k)= b*(...
m1*(...
p(y(j),z1(k))*(n1*Fd(xp(:,i),zp(j),y(k),tt+1) + (1-n1)*Fd(xpp(:,i),zpp(j),y(k),tt+1))+...
댓글 수: 0
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!