Henrique Fernandes
Henrique Fernandes

Reputation: 21

MATLAB: how to solve this constrained optimization in MatLab

I want to do the following constrained optimization problem in MatLab:

Suppose we want to maximize an objective function f(x,t) = x - t, s.t. x is in [-1/t, 1/t]. X is our choice variable and t is a given parameter. Suppose X is in the real and T is in the Real++.

It's obvious, since f(.) is crescent in x and t>0, that, for a given t, the solution will be x*(t)=1/t. But how can I obtain this in Matlab? So that i can plot t vs x*(t).

I started programming this year, then I am sorry if the code I am looking for is too easy. I tried to do it by myself, but I could'nt.

Thank you so much in advance.

Upvotes: 1

Views: 820

Answers (1)

Waseem Anwar
Waseem Anwar

Reputation: 301

If you have optimization toolbox, you can solve constrained optimization problem by using fmincon function. Please click here.

Alternatively you can use the external library Yalmip.

Upvotes: 1

Related Questions