필터 지우기
필터 지우기

Implementation of grid search for a function

조회 수: 5 (최근 30일)
Sardor Butunboev
Sardor Butunboev 2021년 10월 5일
I am trying to run a grid search and find x*. but it gives me "Not enough input arguments".
funktion = @(x) sqrt(x) + 2*sqrt(1-x);
x = [0:0.001:1];
x_star_grid = grid(funktion, x)
function [f_benchmark, domain_max] = grid(funktion, domains)
domain_max = -1e+5;
for i = 1:length(domains)
z= domains(i);
disp(z)
f = feval(funktion, z);
if f>=f_benchmark
f_benchmark = f;
domain_max = domains(i);
end
end
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Direct Search에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by