Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
Prabha Kumaresan
Prabha Kumaresan el 4 de Abr. de 2018
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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 comentarios
Greg
Greg el 4 de Abr. de 2018
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 el 4 de Abr. de 2018
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))

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by