Getting error " 'ga' requires Global Optimization Toolbox'' while running the global optimization command for a stalagmite function.
11 ビュー (過去 30 日間)
古いコメントを表示
clear all
close all
clc
%inputs
x = linspace(0,0.6,150);
y = linspace(0,0.6,150);
[xx, yy] = meshgrid(x,y);
for i = 1:length(xx)
for j = 1:length(yy)
vector(1) = xx(i,j);
vector(2) = yy(i,j);
f(i,j)= stalagmite(vector);
end
end
num_case = 50;
tic
%study_1 - Satistical behaviour
for i = 1:num_case
[inputs, fopt(i)] = ga(@stalagmite, 2);
xopt(i) = inputs(1);
yopt(i) = inputs(2);
end
study1_time = toc
figure(1)
subplot(2,1,1)
hold on
surfc(x,y,f)
shading interp
plot3(xopt,yopt,fopt,'marker','o','markersize',5,'markerfacecolor','r')
title('unbound inputs')
subplot(2,1,2)
plot(fopt)
xlabel('iteations')
ylabel('No of functions')
when i run this code i am getting the error as 'ga' requires Global Optimization Toolbox.
0 件のコメント
回答 (1 件)
Walter Roberson
2021 年 11 月 23 日
The message is correct. The function ga() is part of the Global Optimization Toolbox. You need to have the Global Optimization Toolbox installed and licensed in order to use Mathwork's ga() function.
ga() is not part of basic MATLAB.
[If I recall correctly, the Global Optimization Toolbox requires that you have the Optimization Toolbox installed and licensed.)
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with Optimization Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!