How can I solve a min problem for integral?
Show older comments
Hello.
I've been looking through optimization problem examples and I am not sure how I should solve my problem. The problem is to find a minimum of definite integral such as int(f1(x)-f2(A,B,C,x)). I.e. I want to find A, B and C which will give me minimum value of that integral.
Any advice would be nice.
Answers (1)
Alan Weiss
on 11 Apr 2013
Edited: Alan Weiss
on 11 Apr 2013
Let's reformulate your problem as numerical, not symbolic, because you are going to want a numeric answer.
Also, let's call your three parameters [A,B,C] = y.
So you have a function of y that you want to minimize. Is this a constrained or unconstrained problem? I mean, are there limits on the values in y?
Suppose not. Then for any value of y, I suppose you have a function defined on your MATLAB path that accepts a vector of points x and returns a vector of integrand values:
myintegrand(x,y) = f1(x) - f2(x,y);
Your objective function is
r = @(y)integral(@(x)myintegrand(x,y),xmin,xmax);
Then solve the problem starting from an initial guess y0 to the unknown parameters:
ysolution = fminunc(r,y0)
Alan Weiss
MATLAB mathematical toolbox documentation
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!