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!