I am coding a loop of this kind involving quadprog problem. When I run my cod the quadprog takes only the first result in every loop. How can I give indexing for d=quadprog​(H4{count}​,f4{count}​,A4{count}​,B4{count}​,[],[],LB4​{count},UB​4{count})?

1 visualización (últimos 30 días)
for count=1:100
lambda(count)=1/count^0.5;
omg(count)=10*(lambda(count))^2;
w1(1)=1; w2(1)=2; w3(1)=3; w4(1)=4; w5(1)=-4;
w=[w1(count); w2(count); w3(count); w4(count); w5(count)];
H4{count}=2*lambda(count)*[1.6 1 0 0 0;1 1.6 0 0 0;0 0 1.5 1 0;0 0 1 1.5 0;0 0 0 0 2]+[1 0 0 0 0; 0 1 0 0 0; 0 0 1 0 0;0 0 0 1 0; 0 0 0 0 1];
f4{count}=lambda(count)*([3.1 2 0 0 0;2 3.6 0 0 0;0 0 3.5 2 0;0 0 2 3.3 0;0 0 0 0 2]*w-[1.6 1 0 0 0;1 1.6 0 0 0;0 0 1.5 1 0;0 0 1 1.5 0;0 0 0 0 2]*w+[1;-2;-1;2;-1])-w;
A4{count}=[];
B4{count}=[];
LB4{count}=[-5;-5;-5;-5;-5];
UB4{count}=[5;5;5;5;5];
d=quadprog(H4{count},f4{count},A4{count},B4{count},[],[],LB4{count},UB4{count});
w1(count+1)=d(1,1);w2(count+1)=d(2,1);; w3(count+1)=d(3,1);
w4(count+1)=d(4,1);
w5(count+1)=d(5,1);
end
% i want it to be like d(count)=quadprog(H4{count},f4{count},A4{count},B4{count},[],[],LB4{count},UB4{count}0.
but the matlab will not accept me like this. any one who can help me to fix idexing for this.

Respuestas (0)

Categorías

Más información sobre Parallel Computing Fundamentals en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by