Graphical representation of simplex method

I've solved the problem by hand and confirmed my solution in Matlab to this problem, but I cant figure out the contour plot for it
homework 4.PNG
My code for the plot is:
c=[-10;-8];
A=[.4 .5;.6 .5;1 0; 0 1];
b=[100 80 70 110]';
[X1,X2]=meshgrid(-1:0.1:4);
[C,h]=contour(X1,X2,c(1)*X1+c(2)*X2,20); hold on
clabel(C,h); xlabel('x_1'); ylabel('x_2');
contour(X1,X2,-X1,[0 0],'k','LineWidth',2)
contour(X1,X2,-X1,0.01:0.01:0.1,'Color',[.8 .8 .8])
contour(X1,X2,-X2,[0 0],'k','LineWidth',2)
contour(X1,X2,-X2,0.01:0.01:0.1,'Color',[.8 .8 .8])
contour(X1,X2,A(1,1)*X1+A(1,2)*X2-b(1),[0 0],'k','LineWidth',2)
contour(X1,X2,A(1,1)*X1+A(1,2)*X2-b(1),0.01:0.01:0.1,'Color',[.8 .8 .8])
contour(X1,X2,A(2,1)*X1+A(2,2)*X2-b(2),[0 0],'k','LineWidth',2)
contour(X1,X2,A(2,1)*X1+A(2,2)*X2-b(2),0.01:0.01:0.1,'Color',[.8 .8 .8])
contour(X1,X2,A(3,1)*X1+A(3,2)*X2-b(3),[0 0],'k','LineWidth',2)
contour(X1,X2,A(3,1)*X1+A(3,2)*X2-b(3),0.01:0.01:0.1,'Color',[.8 .8 .8])
contour(X1,X2,A(4,1)*X1+A(4,2)*X2-b(4),[0 0],'k','LineWidth',2)
contour(X1,X2,A(4,1)*X1+A(4,2)*X2-b(4),0.01:0.01:0.1,'Color',[.8 .8 .8])
axis equal
its giving me this:
hwgraphs.PNG
when I want somthign like: What can I do?
help.png

Réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by