Minimization of a integration function

12 ビュー (過去 30 日間)
nabin
nabin 2014 年 8 月 15 日
コメント済み: Alan Weiss 2017 年 10 月 26 日
The given function is f(x)= 4+2x^2
The objective is to find the value of xa such that the following objective function is minimized.
Objective= min (int(f(x),0, xa))
Can you give me idea how to solve this in Matlab?
  1 件のコメント
Matt J
Matt J 2014 年 8 月 15 日
Physiker192 Commented:
why are you using an int to minimize your function? shouldn't you use the derivative??

サインインしてコメントする。

回答 (5 件)

Roger Stafford
Roger Stafford 2014 年 8 月 15 日
In general for minimization problems with constraints you should use 'fmincon'.

Roger Stafford
Roger Stafford 2014 年 8 月 15 日
There can be no finite minimum to this objective function. The more negative you make xa, the more the integral decreases. Minus infinity is the only reasonable answer. You don't need matlab to tell you that.
  1 件のコメント
nabin
nabin 2014 年 8 月 15 日
How can I implement this in Matlab? The function could be some other, I just used an example. (P.S: there is a non negative constraint on xa).

サインインしてコメントする。


Image Analyst
Image Analyst 2014 年 8 月 15 日
If xa were 0, then the integral would not cover any area and the area under the curve 4 + 2 * x^2 would be zero. That looks like it's the minimum the integral can be.
  1 件のコメント
nabin
nabin 2014 年 8 月 15 日
Yes it will be zero indeed. The function I mentioned is just for example. I want to implement it in Matlab so that i can use for more complex problems.

サインインしてコメントする。


Alan Weiss
Alan Weiss 2014 年 8 月 15 日
fun = @(x)integral(@(t)t.*(t-2),0,x); % plot it to see how it looks
[themin,fval] = fmincon(fun,1,[],[],[],[],0,[]) % x lower bound of 0
Alan Weiss
MATLAB mathematical toolbox documentation
  2 件のコメント
Beverly Chua
Beverly Chua 2017 年 10 月 26 日
Hi Alan,
I am trying to do optimization of a nonlinear objective function as well. However, my output equivalent to your "themin" above is not smooth when I try to plot it. I am trying to plot it with respect to time but it keeps spiking up and down. Is there a reason for this?
Thank you!
Alan Weiss
Alan Weiss 2017 年 10 月 26 日
Sorry, I do not exactly understand what you mean. It is possible that you are running into issues alluded to in Optimizing a Simulation or ODE, where an integration is a bit noisy because when you integrate over different regions the integration routine can choose different points, and that adds noise.
But I might misunderstand entirely.
Alan Weiss
MATLAB mathematical toolbox documentation

サインインしてコメントする。


Matt J
Matt J 2014 年 8 月 15 日
編集済み: Matt J 2014 年 8 月 16 日
If the integrand is continuous, the unconstrained stationary points xu are those satisfying
f(xu)=0
If you add positivity constraints, a constrained local minimizer can be found by doing,
[xu,fval]=fzero(@(xu) f(xu), 0 );
if xu>=0 & abs(fval)<somethingsmall
xa= xu;
elseif xu<0 & f(0)>=0
xa=0;
else
warning 'Local min not found'
end

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by