Filter löschen
Filter löschen

solve quadratic for max & min

1 Ansicht (letzte 30 Tage)
zaxven
zaxven am 5 Dez. 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!

Antworten (1)

Walter Roberson
Walter Roberson am 5 Dez. 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 Kommentare
zaxven
zaxven am 5 Dez. 2012
Bearbeitet: zaxven am 5 Dez. 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 am 5 Dez. 2012
Bearbeitet: Walter Roberson am 5 Dez. 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 ?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by