I want get matrix

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 Comment

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.

Sign in to comment.

Answers (0)

Categories

Asked:

mks
on 1 Aug 2023

Commented:

on 1 Aug 2023

Community Treasure Hunt

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

Start Hunting!