Filter löschen
Filter löschen

How do I evaluate this integral?

3 Ansichten (letzte 30 Tage)
Jessica Peterson
Jessica Peterson am 10 Nov. 2019
Beantwortet: Walter Roberson am 10 Nov. 2019
I have the following function.
function height = mount(x,y)
bach = 2000.*1./exp((1.1.*sqrt((x-1).^2+(y-3.5).^2)).^2)
beeth = 2000.*1./exp((2.*(sqrt((x-4.5).^2+(y-1.5).^2))).^2)
hay = -950.*1./exp((1*(sqrt((x-2.8).^2+(y-3.7).^2))).^2)
ridge = 1000.*(1/(1+(1.5*(sqrt((x-2.5).^2+(y-1.8).^2))).^2))
moz = 1500.*(1/(1+(1.1.*(sqrt((x-3).^2+(y-2).^2))).^2))
han = 3500.*(1/sqrt(1+(1.9.*sqrt((x-1).^2+(y-1).^2)).^2))
schu = 2000.*(1/sqrt(1+(2.*sqrt((x-4.25).^2+(y-4.1).^2)).^2))
prae = 200.*sqrt(1+(0.5.*sqrt((x-2.75).^2+(y-3.75).^2)).^2)
main = 7000
height = bach+beeth+hay+ridge+moz+han+schu+prae+main
end
I need to evaluate the integral over the region 0<x<5, 0<y<5, and 0<z<height. I was thinking of doing a double integral by using integral2(height1,0,5,0,5). I created an anoymous function(height 1) of the original function (height); however, matlab is saying that my bounds must be a function of eachother. I am stuck. Help would be appreciated :)
syms x y
height1 =@(x,y) 2000.*1./exp((1.1.*sqrt((x-1).^2+(y-3.5).^2)).^2) + 2000.*1./exp((2.*(sqrt((x-4.5).^2+(y-1.5).^2))).^2) -950.*1./exp((1*(sqrt((x-2.8).^2+(y-3.7).^2))).^2) + 1000.*(1/(1+(1.5*(sqrt((x-2.5).^2+(y-1.8).^2))).^2)) + 1500.*(1/(1+(1.1.*(sqrt((x-3).^2+(y-2).^2))).^2)) + 3500.*(1/sqrt(1+(1.9.*sqrt((x-1).^2+(y-1).^2)).^2)) + 2000.*(1/sqrt(1+(2.*sqrt((x-4.25).^2+(y-4.1).^2)).^2)) + 200.*sqrt(1+(0.5.*sqrt((x-2.75).^2+(y-3.75).^2)).^2) + 7000
integral2(height1,0,5,0,5)

Antworten (2)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH am 10 Nov. 2019
solution:
height1 =@(x,y) 2000.*1./exp((1.1.*sqrt((x-1).^2+(y-3.5).^2)).^2) + 2000.*1./exp((2.*(sqrt((x-4.5).^2+(y-1.5).^2))).^2) -950.*1./exp((1*(sqrt((x-2.8).^2+(y-3.7).^2))).^2) + 1000.*(1/(1+(1.5*(sqrt((x-2.5).^2+(y-1.8).^2))).^2)) + 1500.*(1/(1+(1.1.*(sqrt((x-3).^2+(y-2).^2))).^2)) + 3500.*(1/sqrt(1+(1.9.*sqrt((x-1).^2+(y-1).^2)).^2)) + 2000.*(1/sqrt(1+(2.*sqrt((x-4.25).^2+(y-4.1).^2)).^2)) + 200.*sqrt(1+(0.5.*sqrt((x-2.75).^2+(y-3.75).^2)).^2) + 7000
height1=str2func(vectorize(height1));
integral2(height1,0,0.5,0,0.5,'Method','iterated')

Walter Roberson
Walter Roberson am 10 Nov. 2019
You missed converting some / into ./
height1 =@(x,y) 2000.*1./exp((1.1.*sqrt((x-1).^2+(y-3.5).^2)).^2) + 2000.*1./exp((2.*(sqrt((x-4.5).^2+(y-1.5).^2))).^2) -950.*1./exp((1*(sqrt((x-2.8).^2+(y-3.7).^2))).^2) + 1000.*(1./(1+(1.5*(sqrt((x-2.5).^2+(y-1.8).^2))).^2)) + 1500.*(1./(1+(1.1.*(sqrt((x-3).^2+(y-2).^2))).^2)) + 3500.*(1./sqrt(1+(1.9.*sqrt((x-1).^2+(y-1).^2)).^2)) + 2000.*(1./sqrt(1+(2.*sqrt((x-4.25).^2+(y-4.1).^2)).^2)) + 200.*sqrt(1+(0.5.*sqrt((x-2.75).^2+(y-3.75).^2)).^2) + 7000

Kategorien

Mehr zu Symbolic Math Toolbox 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!

Translated by