Getting error " 'ga' requires Global Optimization Toolbox'' while running the global optimization command for a stalagmite function.
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Walter Roberson
am 23 Nov. 2021
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 Kommentare
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!