Improving speed of nested loops
Mostrar comentarios más antiguos
hi,
I am trying to run nested loops as mentioned in below code.I didn't even see the result even once.It is taking such a long time.Please help me how can i make it faster and how can i estimate time for the same.So that i can wait for those many hours.
Thanks, Sita
clear; clc;
tic p1 = haltonset(1); p2 = haltonset(2); p3 = haltonset(3) ; p4 = haltonset(2) ; p5 = haltonset(2) ;
counti=0; countj=0; countk=0; countl=0; countm=0;
n=1; s=1;% number of times to run
min1=2; max1=3;
min2=2;
max2=3;
min3=2;
max3=3;
min4=2;
max4=3;
min5=2;
max5=3;
min6=2;
max6=3;
min7=2;
max7=3;
min8=2;
max8=3;
min9=2;
max9=3;
min10=2;
max10=3;
for t=1:s
for i=1:10
x1t=p1(i,1);
x1=min1 + ((max1 - min1)*x1t);
counti=counti+1;
for j=1:40
x2t=p2(j,1);
x2=min2 + ((max2 - min2)*x2t);
x3t=p2(j,2);
x3=min3 + ((max3 - min3)*x3t);
countj=countj+1;
for k=1:60
x4t=p3(k,1);
x4=min4 +((max4 - min4)*x4t);
x5t=p3(k,2);
x5=min5 +((max5-min5)*x5t);
x6t=p3(k,3);
x6=min6 +((max6-min6)*x6t);
countk=countk+1;
% for l=1:60
x7t=p4(l,1);
x7=min7+((max7-min7)*x7t);
x8t=p4(l,2);
x8=min8 + ((max8 - min8)*x8t);
countl=countl+1;
for m=1:100
x9t=p5(m,1);
x9=min9+((max9-min9)*x9t);
x10t=p5(m,2);
x10=min10+((max10-min10)*x10t);
countm=countm+1 ;
yal(countm)= fc10(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10);
minvals=min(yal);
end
end
end
end
end
end
toc
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!