Matrix dimensions must agree.

5 views (last 30 days)
Hello , I am new on Matlab and I am trying to find out what's going on here.
Basically the error is :
Matrix dimensions must agree.
Error in EdgeExe2 (line 54)
Tup(k)=Dn/W.*log(1+((Pr.*h)/sigma2)+(Texe));
Could someone help me to find out the reason? Really thanks
for k = 1:length(d1range)
d1 = d1range(k);
L= zeros(length(d1range));
Tupload = zeros(length(d1range));
L(k,:)=((lambda)./(4*pi*(d1range))).^2; %PATH-LOSS
Pr=Pt_w*Gt*Gr*L;
taps=10;
h=randn(1,taps)+j*randn(1,taps);
Tup(k)=Dn/W.*log(1+((Pr.*h)/sigma2)+(Texe));
Tupload(k,:) = Tup(k);
end

Accepted Answer

Setsuna Yuuki.
Setsuna Yuuki. on 6 Dec 2020
Edited: Setsuna Yuuki. on 6 Dec 2020
The arrays dimensions are differents
Dn/W.*log(1+((Pr.*h)/sigma2)+(Texe)) %Is a 10x10 complex matrix
If you use
Tup(k) %You are storing a variable
  3 Comments
Setsuna Yuuki.
Setsuna Yuuki. on 6 Dec 2020
You can use Tup{k}. But it depend on what you need from this array
Tup{k}=Dn/W.*log(1+((Pr.*h)/sigma2)+(Texe));
Tupload = Tup{1,k};
vincenzo violi
vincenzo violi on 6 Dec 2020
I need to calculate this values and plot it. It's about latency calculation according distances variation. But I am stucked before the plot.
Unfortunatelly neither your solution actually really works. Matlab gives me back always same mistake. Anyway thanks the some for your time.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!