solve quadratic for max & min

1 次查看(过去 30 天)
zaxven
zaxven 2012-12-5
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!

回答(1 个)

Walter Roberson
Walter Roberson 2012-12-5
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 个评论
zaxven
zaxven 2012-12-5
编辑:zaxven 2012-12-5
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 2012-12-5
编辑:Walter Roberson 2012-12-5
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 ?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by