Ensure integral don't become complex
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
Hi. I'm trying to optimize a integral of a function on the form of:
sin(acos(x - cos(Phi(x) - pi/4)) + pi/4)
where Phi(x) is a polynomial of some degree (not important which degree tho), and the polynomial coefficients should minimize this integral in the interval [x_start, x_end].
So, my problem is that this easily becomes complex, which fmincon don't handle very well. I have tried to use a nonlinear inequality constraint on (x - cos(Phi(x) - pi/4)) so it stays inside [-1,1], though this will only ensure non-complex answer before integration.
If anyone have thoughts or suggestion to this problem I would really appreciate it.
6 件のコメント
Walter Roberson
2014 年 1 月 31 日
I am uncertain here. Are you using fmincon() varying x, or are you using fmincon varying the polynomial coefficients?
If the polynomial coefficients should minimize the integral, then perhaps the coefficients should be something like all 0 ?
Brede Løvik Lillehammer
2014 年 2 月 2 日
Walter Roberson
2014 年 2 月 2 日
And it is z that needs to be altered for the minimization, right?
Brede Løvik Lillehammer
2014 年 2 月 2 日
Matt J
2014 年 2 月 2 日
I would step back and reconsider the approach you're taking to whatever it is you're doing and see if there isn't a better way to formulate the problem. As you have it now, it isn't even clear that your objective function is differentiable in z. The integrand surely is not, at least not at points where
abs(x - cos(Phi(x) - pi/4))=1
Brede Løvik Lillehammer
2014 年 2 月 2 日
編集済み: Brede Løvik Lillehammer
2014 年 2 月 2 日
回答 (1 件)
Roger Stafford
2014 年 1 月 31 日
I would suggest, instead of using quadrature functions like 'quad' which set their own values for the variable x, that you use 'trapz' for which you can choose the values of x to be used. This would allow you to use the "c<=0" type of constraint in 'fmincon' as applied to the inequalities
max(x-cos(Phi(x)-pi/4))-1<=0
-1-min(x-cos(Phi(x)-pi/4))<=0
where the max and min are taken over all the x points used by 'trapz'. The arguments that are to be adjusted by 'fmincom' in the 'c' inequality functions are of course the coefficients of the polynomial in Phi. You can select the size of the x-interval used by 'trapz' so as to give the required integration accuracy, or as an alternative to 'trapz' you can use the more accurate Gaussian integration method in which again the x values are predetermined.
2 件のコメント
Roger Stafford
2014 年 1 月 31 日
You will probably have to use a variety of coefficient initial estimates in 'fmincon' - that is, the quantity Mathworks calls 'x0'. With the wrong initial values, you may get a local minimum but not the true global minimum. My intuition tells me that this may be particularly true with your kind of problem.
Brede Løvik Lillehammer
2014 年 2 月 2 日
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!