integral2 error message Error using integral2 (line 71) XMIN must be a floating point scalar.

조회 수: 10 (최근 30일)
Create the anonymous function.
fun = @(x,y) 4+(y./25)-(x.^2)./50;
Integrate and to q1, Integrate and to q2
q1 = integral2(fun,-1,1,-1,0)
xmin = @(y) -sqrt(1-y.^2);
xmax = @(y) sqrt(1-y.^2);
q2 = integral2(fun,xmin,xmax,0,1)
Error using integral2 (line 71)
XMIN must be a floating point scalar.
final =q1+q2
anyone can help in this error?

채택된 답변

Walter Roberson
Walter Roberson 2021년 1월 24일
When you use integral2(), the first two time bounds must be scalar floating point constants. The second two time bounds can be either scalar floating point or else function handle.
You are using function handles for your first two time bounds. You need to reverse the order of integration.
xmin = @(y) -sqrt(1-y.^2);
xmax = @(y) sqrt(1-y.^2);
q2 = integral2(@(Y,X)fun(X,Y),0,1,xmin,xmax)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by