clear;clc
hold on
a=0;
while a<0.05
c=[-0.05 -0.27 -0.19 -0.185 -0.185];
A=[zeros(4,1),diag([0.025 0.015 0.055 0.026])];
b=a*ones(4,1);
aeq=[1 1.01 1.02 1.045 1.065];
beq=1;
[x,q]=linprog(c,A,b,aeq,beq,zeros(5,1));
q=-q;
axis([0,0.05,0,0.5]);
plot(x,q,'*k');
a=a+0.001
end
xlabel('a')
ylabel('q')
根据我的程序画出来的图形在很多段都没有点,大部分点都集中在a=0那个y轴了

 Respuesta aceptada

0 votos

你绘出的是x与q的关系图,应该是 plot(a,q,'*k');,对于不同的a,会存在优化出的x相同。

Más respuestas (0)

Categorías

Etiquetas

Community Treasure Hunt

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

Start Hunting!