Why is it not working?

1 回表示 (過去 30 日間)
Rebecca D'Onofrio
Rebecca D'Onofrio 2021 年 9 月 7 日
編集済み: Jan 2021 年 9 月 7 日
I wrote this code, and it does not give any errors, but still I think it is not working since I cannot see any results! Is there any problem?
B2=6E-5;
n=0;
while abs(K-1) > 10^-4
A=zeros(26,26);
for ii=1:26
if ii==jj
A(ii,jj)=D(ii).*B2+(CAPTURE(ii)+FISSION(ii)+ELREM(ii)+INELASTIC(ii));
end
end
A(ii,jj)=A(ii,jj)-SCATTERING(ii,jj);
FLUSSI=A^-1.*MATFIS;
SOURCE=0;
SOURCE=SOURCE+(F39.*FLUSSI+F40.*FLUSSI);
K=SOURCE;
deltaB=10^-6;
B2=B2+deltaB;
n=n+1;
end
R=pi/(sqrt(B2))
  2 件のコメント
Mathieu NOE
Mathieu NOE 2021 年 9 月 7 日
Could not run the code
at least K and jj not defined
Mathieu NOE
Mathieu NOE 2021 年 9 月 7 日
well , most of the variables used in the main loop are not defined / initialized...

サインインしてコメントする。

採用された回答

Simon Chan
Simon Chan 2021 年 9 月 7 日
Index jj is not defined inside the for-loop, i guess the code should be modified as the following
for ii=1:26
for jj = 1:26
if ii==jj
A(ii,jj)=D(ii).*B2+(CAPTURE(ii)+FISSION(ii)+ELREM(ii)+INELASTIC(ii));
end
end
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by