MATLAB Answers

How to solve a multivariable function with restriction

13 views (last 30 days)
Hello, I would like to know how to solve the next function:
with the following restriction:

Accepted Answer

Surya Talluri
Surya Talluri on 12 Oct 2020
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)
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)
You can refer to the solve documentation for more understanding.
  1 Comment
Arturo González Palestino
Thank you very much, this was really helpful for my Economics assignment.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by