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!