Integrate multi-variable function in terms of one variable? With variables as bounds?
이전 댓글 표시
Hi all,
I have an objective function (written as a matlab function) I'm sending to the optimization tool , but I seem to be having trouble correctly stating it. The optimizer will plug in starting values for design variables x1 through x8, before it starts iterating.
function z = Blah(x)
f1 = @(x1) sqrt((1+(2*x(5)*x1)^2));
f2 = @(x2) sqrt((1+(2*x(6)*x2)^2));
f3 = @(x3) sqrt((1+(2*x(7)*x3)^2));
f4 = @(x4) sqrt((1+(2*x(8)*x4)^2));
z = integrate(f1,0,x(1)) + integrate(f2,x(1),x(2)) +...
integrate(f3,x(2),x(3)) + integrate(f4,x(3),x(4));
end
As you can see, I'm trying to integrate with the bounds as the design variables themselves. The integrals only need to be carried out in terms of one design variable (x1 for f1, x2 for f2 ,x3 for f3, x4 for f4) though, and integrate() doesn't give you the option to designate which variable to integrate in terms of. So, I thought stating them as new terms x1,x2,x3,x4 in f1 through 4 as opposed to x(1), x(2), x(3), x(4) would work but it does not:
"Undefined function or method 'integrate' for input arguments of type 'function_handle'."
Any ideas on how to handle such an integral? Thanks for your time.
댓글 수: 2
Walter Roberson
2013년 5월 3일
Which MATLAB version are you using? integrate() is relatively new.
Red
2013년 5월 3일
답변 (1개)
Walter Roberson
2013년 5월 3일
0 개 추천
"integrate" was not available in R2011a. You need to use something like quadgk() or as appropriate taking into account the continuity of your functions and whether you need to integrate to infinity or not.
카테고리
도움말 센터 및 File Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!