possitive solution for set of three nonlinear eqations where t_1 t_2 and pi_2 are varaibles
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi guys,
I have provided a code to solve a set of nonlinear equation where t_1, t_2 and Pi_2 are variables. We know all the variable should be positive.
for my case, I consider
Inputs Parameters
K = 4
N = 1
P_max = 2
T = 2
Noise_Prdb = -100
a= 1e-21
BW = 10
epsilon = 0.0001
For different values of T, my code works but the solution is wrong becuase it gives me a similar values for t_1 which is impossible.
Could you please help me in this regard or give me an alternative to solve this set of equations.
Thank you inadvance
for q = 1:length(P_max)
for r = 1:length(T)
Minimum1 = 0;
P_3 = P_max(q);
R_3 = BW*log2(1+(P_3*h_worst^2)/(BW*Noise_Pr));
t_3 = L3/R_3;
t_1 = 0.0001;
OP_Point = zeros(6,K);
while t_1<T(r)-t_3
Sum = 0;
P_2 = zeros(1,K+1);
for i = K:-1:1
Sum = Sum+P_2(1,i+1)*h(i);
t_2 = T(r)-t_1-t_3;
P_2(1,i) = (2^(L2/(t_2*BW))-1)*(Sum+(BW*Noise_Pr))/(h(i)^2);
if P_2(1,i)>0 && abs(P_max(q)*h(i)*t_1^3-P_2(1,i)*t_2*t_1^2-a*L1^3)<epsilon
OP_Point(1,i) = t_1; OP_Point(2,i) = t_1; OP_Point(3,i) = t_2;
OP_Point(4,i) = t_3; OP_Point(5,i) = P_2(1,i); OP_Point(6,i) = P_3;
else
t_1 = t_1 + 0.0001;
break
end
end
if nnz(OP_Point) == 6*K
break
end
end
end
end
댓글 수: 4
Matt J
2022년 5월 17일
편집: Matt J
2022년 5월 17일
Your code is hard to unpack because you have included all kinds of extra lines which handle data set-up and display, and which have nothing to do with the solving the actual equations. You should show us just the part of your code dedicated to solving the equations. Additonal variables needed to run that part of the code can be attached in a .mat file.
답변 (1개)
Torsten
2022년 5월 17일
Solve the first equation for t_i2.
Solve the second equation for P_i2 and insert the expression for t_i2 from the first equation.
Both t_i2 and P_i2 now should only depend on t1.
Insert the expressions for both in the third equation.
I think you arrive at
Li2/(T-Li3/Ri3-t1) - log2(1 + (Pmax*hi*t1^3-a*Li1^3)*hi^2/(t1^2*(T-Li3/Ri3-t1))/(sum_{m>i}...)) = 0
This is one equation in one unknown.
Use fzero to solve for t1.
Insert t1 in the expressions for t_i2 and P_i2 to get these variables, too.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!