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
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
madhan ravi
am 7 Sep. 2018
Provide all the details which was not defined in the code above and update it so that we could test it ?
Antworten (1)
Walter Roberson
am 7 Sep. 2018
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 Kommentar
Walter Roberson
am 8 Sep. 2018
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)
Siehe auch
Kategorien
Mehr zu Dynamic System Models finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!