Estimate the minimum point given any function

Dear all, would like to get your help on this question!
Given any function input as a m-file,
(For example
function y = f(x)
% This is an continuous function defined on [1,2]
% where you are required to find the minimum.
y= cos(x)^2;
end )
How would you estimate the minimum point such that the estimate is within the error tolerance of 0.01?
I was thinking along this.. I can calculate the real exact value of the minimum point, but I need to use a method to estimate the minimum point so that the error between the real and the estimate is less than 0.01. But not sure what method I need to use to estimate the minimum point.
So far, Ive learnt bisection method, newton mtd, secant method in school.
THANK YOU

回答 (2 件)

A Jenkins
A Jenkins 2013 年 10 月 11 日

0 投票

FMINBND Single-variable bounded nonlinear function minimization.
X = FMINBND(FUN,x1,x2) attempts to find a local minimizer X of the function FUN in the interval x1 < X < x2. FUN is a function handle. FUN accepts scalar input X and returns a scalar function value F evaluated at X.
Unless your professor wants you to write your own...
Matt J
Matt J 2013 年 10 月 11 日

0 投票

You could just sample the function and use MIN, as proposed here,

カテゴリ

ヘルプ センター および File ExchangeEncryption / Cryptography についてさらに検索

質問済み:

May
2013 年 10 月 11 日

回答済み:

2013 年 10 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by