Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Could anyone help me to solve the issue for the following code

1 回表示 (過去 30 日間)
Prabha Kumaresan
Prabha Kumaresan 2018 年 4 月 4 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Code:
Bmax=2000;
noise=1e-5;
p_fix=0.05;
for it=1:2
G =[4.2638 4.2227 4.2658 4.4176 4.6851 5.0623
2.2943 2.3644 2.4166 2.4525 2.4750 2.4880
0.0637 0.0599 0.0563 0.0533 0.0509 0.0494
0.0427 0.0429 0.0431 0.0432 0.0434 0.0435];
C =[4.2638 0 0 0 0 5.0623
0 0 0 0 2.4750 0
0 0 0.0563 0 0 0
0 0.0429 0 0.0432 0 0]
t=4;
r=6;
throughput =((Bmax.*log(1+((p_fix).*C))./ noise))
overall_throughput = sum(sum(throughput))
output(t,r)=overall_throughput
output_it(t,r,it)=output(t,r)
end
If i run the following code it executes.
But for every iterations the output remains the same value.
Could anyone help me how to get different values of output for every iteration.
  2 件のコメント
Greg
Greg 2018 年 4 月 4 日
Everything in there is a constant. You can move it all out of the loop. The first thing to look for to spot this is not using your loop variable anywhere but an assignment index.
At least one value somewhere needs to change inside the loop, either randomly or based on the loop iteration.
Greg
Greg 2018 年 4 月 4 日
Also, why all the intermediate variables?
overall_throughput = sum(sum(throughput))
output(t,r)=overall_throughput
output_it(t,r,it)=output(t,r)
Can be
output_it(t,r,it)=sum(sum(throughput))

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by