solve quadratic for max & min

5 views (last 30 days)
zaxven
zaxven on 5 Dec 2012
how to solve this quadratic equation for Max & Min values:
A1*x1^2 + B1*x1*x2 + C1*x2^2 + D1*x1 + E1*x2 + F1
can't find a proper explanation. Please!

Answers (1)

Walter Roberson
Walter Roberson on 5 Dec 2012
If A1 is negative, then for every finite x2, the mininum is at x1 = +/- infinity.
If C1 is negative, then for every finite x1, the minimum is at x2 = +/- infinity.
Otherwise, for every finite x1 and finite x2, the minimum is at
x1 = (B1*E1-2*C1*D1)/(-B1^2+4*C1*A1)
x2 = -(2*A1*E1-D1*B1)/(-B1^2+4*C1*A1)
If A1 and C1 are opposite signs, then when x1 and x2 are both infinite, the minimum is undefined.
  2 Comments
zaxven
zaxven on 5 Dec 2012
Edited: zaxven on 5 Dec 2012
thanks!but now if i do mesh grid i get an empty matrix. plus contour doesn't plot.
Error using contour : Z must be size 2x2 or greater.
[x1 x2] = meshgrid(x1min:delta:x1max, x2min:delta:x2max);
%% delta = b^2-4ac %% assuming minimums to be -inf
Z = a*x1.^2 + b*x1.*x2 + c*x2.^2 + d*x1 + e*x2 + f;
contour(z1,z2,Z);
Walter Roberson
Walter Roberson on 5 Dec 2012
Edited: Walter Roberson on 5 Dec 2012
What values do you have for x1min, x1max, x2min, x2max, and delta? You might be in a situation where one of x1min:delta:x1max or x2min:delta:x2max are empty, in which case Z would come out empty.
Also, what are z1 and z2 ?

Sign in to comment.

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!