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.

 Réponse acceptée

KSSV
KSSV le 1 Jan 2018

1 vote

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 commentaires

Prabha Kumaresan
Prabha Kumaresan le 1 Jan 2018
Modifié(e) : Walter Roberson le 1 Jan 2018
After changing into
output_Et_it(t,r,it)=output_E(t,r);
I am getting
Undefined function 'sum' for input arguments of type
'function_handle'.
Error in (line 13)
overall_throughput_Et = sum(sum(throughput_Et));
It is not clear why you changed that code from your previous
overall_throughput_E(t) = sum(sum(throughput_E(t)));
Function handles can be:
1) Assigned to a variable, as in
MyFun = @(t) exp(-t) - sin(t);
SecondVariable = MyFun;
2) Passed to another function, as in
MyFun = @(t) exp(-t) - sin(t);
fzeros(MyFun, 5)
3) Invoked, as in
sum(MyFun(0:.1:5))
Any other use is not valid. You cannot sum() a function handle, for example: you have to sum() the result of invoking the function handle.
Prabha Kumaresan
Prabha Kumaresan le 2 Jan 2018
Modifié(e) : Walter Roberson le 2 Jan 2018
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);
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.

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 1 Jan 2018

0 votes

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)

Catégories

En savoir plus sur Aerospace Blockset dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by