How do I evaluate this integral?
조회 수: 1 (최근 30일)
이전 댓글 표시
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)
댓글 수: 0
답변 (2개)
JESUS DAVID ARIZA ROYETH
2019년 11월 10일
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')
댓글 수: 0
Walter Roberson
2019년 11월 10일
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!