How to optimize a function?

1 Ansicht (letzte 30 Tage)
Ammy
Ammy am 14 Mai 2018
Kommentiert: KALYAN ACHARJYA am 14 Mai 2018
f(x)=x^2+2x-3
x belong to [0,20]
i- How can I optimize the function in matlab?
  3 Kommentare
Ammy
Ammy am 14 Mai 2018
How to maximize a function, or how to minimize a function, or in other words on which x value the function gives maximum or minimum value.
Torsten
Torsten am 14 Mai 2018
Use "fmincon" with the bound constraints x>=0 and x<=20.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Torsten
Torsten am 14 Mai 2018
x1=0;
x2=20;
fun=@(x)x^2+2x-3;
x = fminbnd(fun,x1,x2)

Weitere Antworten (0)

Kategorien

Mehr zu Nonlinear Optimization finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by