1)Error using integral2ParseArgs (line 13)Expected a string for the parameter name,instead the input was 'double' 2)Error in integral2 (line 104) opstruct = integral2ParseArgs(isImproper,varargin{:}); I am getting these two errors.what should bedone
조회 수: 3 (최근 30일)
이전 댓글 표시
pdf=N*exp(-N.*x);
xmin=0;
xmax=b;
ymin=0;
ymax=inf;
f=@(x,y)log(1+((Zt.*y).\(Zs.*x)+1))+log(1+((Zt.*y).\(Zi+1))).*pdf;
A= integral2(f,y,ymin,ymax,x,xmin,xmax);
댓글 수: 2
madhan ravi
2018년 9월 7일
Provide all the details which was not defined in the code above and update it so that we could test it ?
답변 (1개)
Walter Roberson
2018년 9월 7일
q = integral2(fun,xmin,xmax,ymin,ymax)
Notice that variable name is not passed as part of the bounds and that you cannot pass y boundaries before x boundaries.
Symbolic integration requires that the name of the variable be passed before the bound but numeric integration is fixed order
댓글 수: 1
Walter Roberson
2018년 9월 8일
I stand by my response. You should not be passing in the variable name for integral2().
You can use
B = integral2(@(y,x) fun1(x,y), ymin, ymax, xmin, xmax)
if you need the y to be the "inner" variable for integration.
Order that the parameters vary should not matter if the bounds are fixed: it should only matter if the bounds are expressed in terms of each other. For example,
integrate fun1(x,y) over y = 0 to 5, x = 0 to sin(y)^2
then in that case the x passed into fun1 would have to be the second set of bounds because integral2 can accept functions handles for the second set of bounds but not for the first:
B = integral2(@(y,x) fun1(x,y), 0, 5, 0, @(y) sin(y).^2)
참고 항목
카테고리
Help Center 및 File Exchange에서 Encryption / Cryptography에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!