clear all
close all
clc
x=linspace(0,0.6,150);
y=linspace(0,0.6,150);
%creating 2Diamensional mesh
[xx,yy]=meshgrid(x,y);
[x,fval]= ga(@stalagmite,2)
for i=1:length(xx)
for j=1:length(yy)
input_vector(1)=xx(i,j);
input_vector(2)=yy(i,j);
f(i,j)=stalagmite(input_vector);
end
end
surfc(xx,yy,f)
shading interp
subplot(2,1,1)
[x,fval]= ga(@stalagmite,2)
plot3(xx,yy,f,'marker','o','markersize',3,'markerfacecolor','r')
title('Unbounded inputes')
subplot(2,1,2)
plot(f)
xlabel('iteration')
ylabel('Function minium')
tic
for i=1:length(xx)
for j=1:length(yy)
input_vector(1)=xx(i,j);
input_vector(2)=yy(i,j);
f(i,j)=stalagmite(input_vector);
end
end
timestudy2=toc
surfc(xx,yy,f)
shading interp
subplot(2,1,1)
[x,fval]= ga(@stalagmite,2)
plot(xx,yy,f,'marker','o','markersize',3,'markerfacecolor','r')
title('Unbounded inputes')
subplot(2,1,2)
plot(f)
xlabel('iteration')
ylabel('Function minium')
options= optimoptions('ga');
options=optimoptions(options,'PopulationSize',170);
tic
for i=1:length(xx)
for j=1:length(yy)
input_vector(1)=xx(i,j);
input_vector(2)=yy(i,j);
f(i,j)=stalagmite(input_vector);
end
end
timestudy3=toc
surfc(xx,yy,f)
shading interp
subplot(2,1,1)
[x,fval]= ga(@stalagmite,2)
plot(xx,yy,f,'marker','o','markersize',3,'markerfacecolor','r')
title('Unbounded inputes')
subplot(2,1,2)
plot(f)
xlabel('iteration')
ylabel('Function minium')