필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
nag raj
nag raj 2020년 7월 17일
편집: Walter Roberson 2020년 7월 17일
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
nag raj
nag raj 2020년 7월 17일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by