How do I evaluate this triple integral using the function integral3
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
bob
am 10 Nov. 2020
Kommentiert: bob
am 10 Nov. 2020
xmin= @(y) y.^2
xmax= @(y) y.^0.5
ymin=0
ymax=1
zmin=0
zmax=@(x,y,z) x+y+36
h = @(y,x,z) 1 %dz dx dy
answer3 = integral3(h, ymin, ymax , xmin , xmax , zmin, zmax);
answer3 = vpa(answer3,8)
%%why doesnt this code work, can someone help me
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Nov. 2020
xmin= @(y) y.^2
xmax= @(y) y.^0.5
ymin=0
ymax=1
zmin=0
zmax=@(x,y,z) x+y+36
h = @(y,x,z) ones(size(y)) %dz dx dy
answer3 = integral3(h, ymin, ymax , xmin , xmax , zmin, zmax);
answer3 = vpa(answer3,8)
3 Kommentare
Walter Roberson
am 10 Nov. 2020
The integral() family of functions call the given function passing in vectors or arrays of values, expecting the same size of output, using element-wise computations.
So your h(y,x,z) was being called with non-scalar y, x, z, but you were returning the scalar constant 1 no matter what the input size was. You need to return one of those 1's for every input element.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differential Equations 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!