Optimization of a linear function with range of variables

2 views (last 30 days)
I have a simple optimization problem. The objective function consists of 4 variables, say a,b,c and d. so objective function y=f(a,b,c,d). y is a linear function.
and constraints for this variables are only range for that variable say a= 3 to 10, b= 25 to 35, c= 80 to 100 and d = 30 to 45. My question is which optimization technique/method/function i can use to get maximum value of 'y' in MATLAB. and how to plot all this variables in MATLAB to get 'y'

Accepted Answer

Alan Weiss
Alan Weiss on 18 Mar 2013
You can solve this kind of problem numerically using the linprog function in Optimization Toolbox.
You can solve this kind of problem symbolically using the solve function in Symbolic Math Toolbox.
Alan Weiss
MATLAB mathematical toolbox documentation
  3 Comments
Alan Weiss
Alan Weiss on 21 Mar 2013
Edited: Alan Weiss on 21 Mar 2013
You have several errors in your objective function. Please take a look at the documented linprog syntax. Or don't bother, because linprog will not work for this function anyway.
This is not a linear function. Several variables divide others.
Even using fmincon, the nonlinear constrained solver, you need to put all your variables in one vector, typically called x. Then you can do something like
function f = objfun(x)
Te = x(1);
Ta = x(2);
Tg = x(3);
Tc = x(4);
f = (Tg-Ta)/Tg + Te/(Tc-Te);
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Shishir Jaiswal
Shishir Jaiswal on 25 Mar 2013
Got it Sir.... Thank you very much. I should have read the documentation carefully.

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!