MATLAB: How to draw a graph for function with constraints constraintfunctionplot 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 ? Best Answer fimplicit(@(x,y) x.^2 + 4*x.*y +5*y.^2 - 10,'r'); hold on; fcontour(@(x,y) 3*x+4*y) ; hold off Related SolutionsMATLAB: How can i represent 2 functions on the same graph One option is the fimplicit (link) function:f1 = @(x,y) 2*x.^3-5*x-2*y.^3+1;f2 = @(x,y) x.^4+4*y.^4.*y-6;figure(1)fimplicit(f1, [-10 10 -10 10])hold onfimplicit(f2, [-10 10 -10 10])hold offlegend('f_1(x,y)', 'f_2(x,y)', 'Location','NW') MATLAB: How to index lmi constraints Something like this would be a complete vectorizationn = 3;[i,ii] = find(triu(ones(n),1));index = sub2ind([n n],i,ii)a1 = binvar(length(i),1);a2 = binvar(length(i),1);K = sdpvar(n);F = [implies(a1, K(index) <= -0.1), implies(a2, K(index) >= 0.1), a1 + a2 == 1] Related Question
Best Answer