how to make this graph?
显示 更早的评论
It is a simple doubt, but I am unable to resolve it. How can I plot these 3 functions together so that I can see them in full? do i really have to use meshgrid and contour?
[x1,x2]=meshgrid(-2:.1:4, -2:.1:4);
cost=x1.^2 + x2.^2 - 5*x1 - 6*x2 + 15;
contour(x1,x2,cost,1,'g','LineWidth',1)
figure(1)
y=2*x1.^2 + 2*x2.^2 - 3*x1 - 3*x2 - 2;
z=x1.^2 + x2.^2 - 4*x1 - 3*x2 + 8;
hold on
contour(x1,x2,y,1,'k','LineWidth',1)
contour(x1,x2,z,1,'k','LineWidth',1)
xlim([-2 4])
ylim([-2 4])
currently my result is this:

and I need it to be like this:

采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!