How to solve a multivariable function with restriction
조회 수: 1 (최근 30일)
이전 댓글 표시
Arturo González Palestino
2020년 10월 8일
댓글: Arturo González Palestino
2020년 10월 14일
Hello, I would like to know how to solve the next function:
u(x,y,z,w,t)=(x^0.21*y^0.26*z^0.21*w^0.14*t^0.18)
with the following restriction:
25x+30y+25z+31.775w+30t=8000
댓글 수: 0
채택된 답변
Surya Talluri
2020년 10월 12일
I understand that you want to find the function value with other conditions satisfying. You can use Symbolic Math Toolbox to do this.
syms x y z w t u(x,y,z,w,t)
u(x,y,z,w,t)=(x^0.21*y^0.26*z^0.21*w^0.14*t^0.18)
f = 25*x+30*y+25*z+31.775*w+30*t==8000
You can find the variables satisfying above conditions using “solve” function
sol = solve(f, {x, y, z, w, t},'ReturnConditions',true)
As the given condition have infinite possible variables, It will return the variable values in parametric form If 'ReturnConditions' parameter is set to true. You will obtain a single solution from the infinite possible solutions if the parameter is set to false (default).
You can obtain value of function by directly substituting the solution obtained.
u(sol.x, sol.y, sol.z, sol.w, sol.t)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!