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

Antworten (0)

Kategorien

Mehr zu Deep Learning Toolbox finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 9 Apr. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by