integration of a function of two variables in which the limits of integral on one are functions of the other

조회 수: 1 (최근 30일)
I want to integrate the function f(x,theta)={1-exp[-alpha/sin(theta)]} over x and theta. x has definite limits, but the limits of the integral over theta, are functions of x. So, I don't think I can use intergral2. Any suggestions?

채택된 답변

Steven Lord
Steven Lord 2018년 3월 1일
"q = integral2(fun,xmin,xmax,ymin,ymax) approximates the integral of the function z = fun(x,y) over the planar region xmin ≤ x ≤ xmax and ymin(x) ≤ y ≤ ymax(x)."
The limits on y can be functions of x. The "Evaluate Double Integral in Polar Coordinates" example on that page includes an example where the upper limit on r is a function of theta.
  댓글 수: 3
Ranjan Sonalkar
Ranjan Sonalkar 2018년 3월 1일
Still having trouble, however. The output of the inner integral over theta is divided by the difference of the limits, (theta2-theta1), where theta1 and theta2 are the functions of the outer variable, x. So, I have defined theta1 and theta2 as functions of x, just as rmax in the example. But when I divide the integrand by the difference [./(theta2-theta1)] I am getting an error - "Undefined operator './' for input arguments of type 'function_handle'."
Steven Lord
Steven Lord 2018년 3월 1일
You can't perform arithmetic on function handles. You can perform arithmetic on the values you receive from evaluating function handles.
fh = @sin;
x = fh(pi/4).^2 % works
y = fh.^2 % does not work
Evaluate your theta2 and theta1 functions for the values of theta that integral2 passed into your integrand function.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by