필터 지우기
필터 지우기

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