how to overcome the error

2 次查看(过去 30 天)
Bmax=2000000; %maximum available bandwidth for OFDMA
noise=1e-9; %fixed noise power is assumed
p_fix=0.01; %fixed transmit power is assumed
N_UE=[10 20 30 40 50 ];
N_SC=[60 70 80 90 100];
for it=1:2
for t= 1:length(N_UE)
for r = 1:length(N_SC)
throughput_E(t) = @(t) Bmax * log2(1 + p_fix(t)*gamma(t) / sum(p_fix(1:t-1) .* gamma(t) ));
overall_throughput_E(t) = sum(sum(throughput_E(t)));
output_E(t,r)=overall_throughput_E(t);
output_E(t)_it(t,r,it)=output_E(t,r);
end
end
end.
If i run the code i am getting
Error: File: Line: 12 Column: 12
The input character is not valid in MATLAB
statements or expressions.

采纳的回答

KSSV
KSSV 2018-1-1
This line is not correct:
output_E(t)_it(t,r,it)=output_E(t,r);
You should change it to:
output_Et_it(t,r,it)=output_E(t,r);
  4 个评论
Prabha Kumaresan
Prabha Kumaresan 2018-1-2
编辑:Walter Roberson 2018-1-2
The reason i have changed the code is due to the throughput expression which was given below.
If i run the code i am getting the error as stated before.
throughput_Et = @(t)Bmax * log2(1 + p_fix(t)*gamma(t)/sum(p_fix(1:t-1).* gamma(t)));
overall_throughput_Et = sum(sum(throughput_Et));
output_E(t,r)=overall_throughput_Et;
output_Et_it(t,r,it)=output_E(t,r);
Walter Roberson
Walter Roberson 2018-1-2
You define
p_fix=0.01; %fixed transmit power is assumed
which makes p_fix a scalar. But you are using p_fix(t) and p_fix(1:t-1) which assume that t is either empty or is exactly 1 or is true or false (otherwise you would be indexing outside the array.)
You are looping over it and t and r but your calculations do not use it or r so taking a 2D sum does not make any sense.

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2018-1-1
Your code line is
output_E(t)_it(t,r,it)=output_E(t,r);
Underscore is not a valid character immediately after the (t)

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by