I want get matrix

2 次查看(过去 30 天)
mks
mks 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