MATLAB Answers

0

Array indices must be positive integers or logical values.ERROR

Asked by Shahd Altalhi on 12 Nov 2019 at 21:08
Latest activity Answered by David Hill on 12 Nov 2019 at 21:20
for d=0:5:50
Pl=40*log(d)-(10*log(gt)+10*log(gr_s)+20*log(ht)+20*log(hr));
Rss= pt+gt+gr_s-L50-L;
SNIR= Rss/n+I;
c=B*log(1+SNIR);
throuput1=(c(B*log(1+SNIR)));
end

  0 Comments

Sign in to comment.

Tags

2 Answers

Answer by Walter Roberson
on 12 Nov 2019 at 21:14

c(B*log(1+SNIR)) is a request to index the variable c at the computed value. MATLAB does not have any implicit multiplication: if you want multiplication you need the * or .* operator.

  0 Comments

Sign in to comment.


Answer by David Hill on 12 Nov 2019 at 21:20

throuput1=(c*(B*log(1+SNIR)));%I think you left out a * (c*...) otherwise you are trying to index into c
Also, log(0) will be -inf. Do you want to start out at d=0?

  0 Comments

Sign in to comment.