I want get matrix

조회 수: 1 (최근 30일)
mks
mks 2023년 8월 1일
댓글: Walter Roberson 2023년 8월 1일
matrix_FA=zeros(SSf,SSa);
Ln_total=0;
while Ln_total<round(C0*SSf*SSa)
Type=randi(2); %,1:P->A; 2:A->P
if Type==1
if rand<=P_N
f_si=randsrc(1,1,[1:SSf;F_site/sum(F_site)]);
else
f_si=randsrc(1,1,[1:SSf;1/SSf*ones(1,SSf)]);
end
si_part=ceil(4*f_si/SSf);
if rand<=P_Q
A_rang=1+(si_part-1)*SSa/4:si_part*SSa/4;
A_dens=A_site(1+(si_part-1)*SSa/4:si_part*SSa/4);
else
A_rang=1:SSa;
A_dens=A_site;
end
if rand<=P_N
a_si=randsrc(1,1,[A_rang;A_dens/sum(A_dens)]);
else
a_si=randsrc(1,1,[A_rang;1/length(A_rang)*ones(1,length(A_rang))]);
end
please help me how they create this matrix
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 8월 1일
You initialize matrix_FA but you never store anything into it?
You calculate several variables but you do not take copies of them each iteration, so the final result stored in them is going to be whatever was stored in the last iteration.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by