Filter löschen
Filter löschen

Index in position 2 exceeds array bounds (must not exceed 1).

1 Ansicht (letzte 30 Tage)
nag raj
nag raj am 17 Jul. 2020
Bearbeitet: Walter Roberson am 17 Jul. 2020
function [Qr, lolb] = solveP3(Qr,Xr)
global K M H alpha beta0 delta_t Dmax B sigma_2 Lamda Pk q0 qF Sk F_1 w u tolerance
Ql = Qr;
l = 0;
tol = tolerance;
Lo = [];
for l = 1: 1000
Qlt = repelem(Ql,1,1,K);
J = H^2 + sum( (Qlt - w).^2 ,1);
J = reshape(J, [M,K] );
I = F_1*Pk*dB2dec(beta0)*(alpha/2)*log2(exp(1)) ./ (J .* (dB2dec(sigma_2) * dB2dec(Lamda) * J .^(alpha/2) + F_1*Pk*dB2dec(beta0)));
A = log2(1 + (F_1*Pk*dB2dec(beta0)) ./ (dB2dec(sigma_2) * dB2dec(Lamda) * J .^(alpha/2)) );
cvx_begin quiet
variables Q(2,M)
variables lo(1)
expression LO(K)
maximize (sum(lo))
subject to:
for k = 1 : K
LO(k) = 0;
for m = 1 : M
Rlb = A(m,k) - I(m,k) * (sum_square_abs( Q(:,m) - u(:,k))) + I(m,k) * (sum_square_abs( Ql(:,m) - u(:,k)));
LO(k) = LO(k) + Xr(m,k) * Rlb;
end
(1/(Sk/(B*delta_t))) * LO(k) >= lo; %Constraint (17)
end
for m = 2: M
norm(Q(:,m) - Q(:,m-1)) <= Dmax;
end
Q(1,1) == q0(1);
Q(2,1) == q0(2);
Q(1,M) == qF(1);
Q(2,M) == qF(2);
cvx_end
Lo = [Lo;sum(lo)];
Ql = Q;
if (l >= 2) &&(Lo(l) - Lo(l-1) < tol)
break;
end
end
Qr = Q;
lolb = Lo(l);
end
function [dB] = dec2dB(dec)
dB = 10*log10(dec);
end
function [dec] = dB2dec(dB)
dec = 10.^(dB/10);
end
  1 Kommentar
nag raj
nag raj am 17 Jul. 2020
It's function is used by another program where I got the results by execution. But individually run of this program occurs an index position error, is it happens such a case in general. And also ignoring for loop iteration I got an output but the loop is not working. I guess that the whole code will run in another program without any errors.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by