Using simpson 1/3 rule for double integration I want to give first only y limit then after getting this integration I want to give x limit f(x,y)=sin(x)(A1sinh(y)+B1sinh(b-y))+ C1sin(x)*sinh(b-y)+D1sin(x)*sinh(y)+E1sinh(Lx)* sin(y)+sinh(x)*sin(y)
6 次查看(过去 30 天)
显示 更早的评论
is there a method in simpson 1/3 rule for double integration that first i give only y limit after getting this integration i give x limit and function has both x and y variable in multiplication so i cant use simpson 1/3 rule for single integration i am using a simpson 1/3 rule for double integration the code but in this code i have to give x and y limit both at a same time the code is
syms x y;
f = inline(f(x,y));
c = inline('1');
d = inline('2');
a =0;
b = x;
m = 4;
n = 4;
hx = (b-a)/n;
An = 0;
Ae = 0;
Ao = 0;
for i = 0:n
x = a + i*hx;
ya = c(x);
yb = d(x);
hy = (d(x) - c(x))/m;
Bn = f(x,ya) + f(x,yb);
Be = 0;
Bo = 0;
for j = 1:m-1
y = ya + j*hy;
z = f(x,y);
if rem(j,2)==0
Be = Be + z;
else
Bo = Bo + z;
end
end
A1 = (Bn + 4*Bo + 2*Be)*hy/3;
if i == 0 | i == n
An = An + A1;
else
if rem(i,2)==0
Ae = Ae + A1;
else
Ao = Ao + A1;
end
end
end
Dint = (An + 4*Ao + 2*Ae)*hx/3;
end
2 个评论
Torsten
2015-11-2
is there a method in simpson 1/3 rule for double integration that first i give only y limit after getting this integration i give x limit
Why do you want to do this ?
Best wishes
Torsten.
采纳的回答
Torsten
2015-11-4
Write down the Simpson-rule approximation for
integral_{y=c}^{y=d) exp(f(x,y)) dy .
This will be a finite sum including the variable x. Call it sum(x).
Thus under the first integral you have an expression of the form 1/sum(x) to integrate over [a:b].
Now apply Simpson's rule again in x-direction.
Best wishes
Torsten.
4 个评论
Torsten
2015-11-9
编辑:Torsten
2015-11-9
In function I(x), you evaluate
1/integral_{y=c}^{y=d) exp(f(x,y)) dy
for a given value of x.
Thus by calling
result = simpson(@(x)I(x),a,b,deltax);
you integrate
1/integral_{y=c}^{y=d) exp(f(x,y)) dy
from x=a to x=b which should give you the integral you try to evaluate.
If you have problems, you may want to post the complete code you are using such that we can check it for errors.
Best wishes
Torsten.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!