Info
此问题已关闭。 请重新打开它进行编辑或回答。
Could anyone help me to solve the issue for the following code
1 次查看(过去 30 天)
显示 更早的评论
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
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
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!