필터 지우기
필터 지우기

How to turn this function into function with handle that is suitable for particle swarm ?

조회 수: 2 (최근 30일)
I have a function like this :
function y = Sum_throughput_U1_phase2(beta,a1_t2,a2_t2, SNRdB,M, Rate1, Rate2,eta_BS,xai,L1,L3)
gama1 = 2^(2*Rate1/(1-beta)) - 1;
gama2 = 2^(2*Rate2/(1-beta)) - 1;
phi1 = 0;
constraint1 = a1_t2 - phi1*gama1*a2_t2 > 0;
constraint2 = a2_t2 - gama2*a1_t2 > 0;
if constraint1 && constraint2
SNR = 10^(SNRdB/10);
Psi1 = 2*eta_BS*beta/(1-beta);
cuc1 = gama1/(a1_t2*xai*Psi1*SNR);
cuc2 = gama2/( (a2_t2-gama2*a1_t2)*(xai*Psi1*SNR) );
delta_one = max(cuc1,cuc2);
term1 = 2/factorial(M-1);
term2 = delta_one/(L3*L1);
Outage_Near_User = 1 - term1*power(term2,M/2)*besselk(M,2*sqrt(term2));
elseif ~constraint1 && ~constraint2
Outage_Near_User=1;
end
y = (1-Outage_Near_User)*Rate1;
end
Bassically it compute this thing here which is called the throughput
I want to optimize this throughput with respect to 3 variables by using particle swarm optimization particleswarm(fun,nvars):
beta,a1_t2,a2_t2
Require to add something call function handle @(x).
Please help me to turn the function Sum_throughput_U1_phase2(beta,a1_t2,a2_t2, SNRdB,M, Rate1, Rate2,eta_BS,xai,L1,L3) into the function with handle that is suitable for using particle swarm optimization with three decision variable beta,a1_t2,a2_t2
Note that .
I just have one thinking that it might be possible throught the use of the funcion matlabFunction to Convert symbolic expression to function handle or file but still strugle with the actual implementation !
P/S Any help that mirror the situation is okay, I dont want you to waste too much time
Thank you very much !
  댓글 수: 1
Stephen23
Stephen23 2021년 6월 17일
As you are not using symbolic variables the symbolic toolbox function matlabFunction is unlikely to help you.
For the inputs that you want to optimize, define them as one input to your function, following the instructions here:
For the rest of those inputs you can parameterize the function:

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by