optimize vector by fminimax
이전 댓글 표시
if i uuse fminimax to optimize vector how it recognize which element is suitable for it here is example
clear all
q=20;
random_numbersw = rand(1,20); % Random number from 0 to 1
random_numberst = -90 + (90 + 90) * rand(1, 20); % Random number from -90 to 90
x0 = [ random_numberst,random_numbersw ] ; %Initiat delta
ub = zeros(1, 40); % Initialize a matrix of zeros with 40 elements
ub(1:20) = 1; % Set values from 1 to 21 to 0
ub(21:40) = 90; % Set values from 22 to 40 to 90
lb = zeros(1, 40); % Initialize a matrix of zeros with 40 elements
lb(1:20) = 0; % Set values from 1 to 21 to 0
lb(21:40) = -90; % Set values from 22 to 40 to 90
[x,fval] = fminimax(@costy,x0,[],[],[],[],lb,ub)
function y = costy(deltaTeta)
f=9*10^9; %Freq
j=sqrt(-1); %Define Imaginary
l=(3*10^8)/f; %Lambda
k=(2*pi)/l; %Constant
d=0.5*l; %Distant of each element
q=20;
teta1=((-4):0.1:(-2));
g = zeros(q,length(teta1));
for h=1:q
for aa = 1:length(teta1)
g(h,aa) = g(h,aa)+(deltaTeta(h) * ( exp(j*(h-1) * (k*d*sind(teta1(aa)+deltaTeta(h+q)))))); %w W
end
end
y = abs(sum(g,1));
end
teta1=((-4):0.1:(-2)); is my input which it is not for optimize and my function should sweep it everytime and i want to optimize deltaTeta
here i s another example for more clearify my question if with my first input i have this vector (output) (1 2 5 6 9 5) and with next input i have this one (1 2 9 6 9 1) as you can see in two point they have different but in first one first input is minimize but second one is next input is minimize so how my function( here fminimax) recognize which input is suitable?
and is fminimax is good for it?
댓글 수: 1
Torsten
2023년 11월 27일
Please describe your optimization problem - once the forum understands it, we might be able to select a suitable solver for it.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!