MATLAB Answers

How to draw a graph for function with constraints?

14 views (last 30 days)
Trang To
Trang To on 1 Jul 2020
Commented: Trang To on 2 Jul 2020
How can I draw the contour plot of the function z = 3x + 4y and the constraint curve x^2 + 4xy +5y^2 = 10 in the same figure ?

  0 Comments

Sign in to comment.

Accepted Answer

Matt J
Matt J on 1 Jul 2020
fimplicit(@(x,y) x.^2 + 4*x.*y +5*y.^2 - 10,'r'); hold on; fcontour(@(x,y) 3*x+4*y) ; hold off