how to write a user defined function that calculates the maximum or minimum of a quadratic equation of the form

16 ビュー (過去 30 日間)
How can we write a user-definedfunction that calculates maximum and minimum of an quadratic equation.
since i know how to find max and min of an array only.
This question has been troubling me for days. If anyone could solve it

回答 (1 件)

Ildeberto de los Santos Ruiz
Ildeberto de los Santos Ruiz 2019 年 11 月 1 日
Try this:
---------------------
f = @(x) x^2-5*x+6;
initial = 0;
fminsearch(f,initial)
---------------------
To find a maximum, use -f instead of f.

カテゴリ

Help Center および File ExchangeQuadratic Programming and Cone Programming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by