matlab中如何计算积分上限为无穷大的情况? 10
被积函数:f(t)=2*lamd/(t^2)*exp(-2*lamd/t)*(1-exp(-2*lamd/t))^4*exp(-2*lamd/(t-c));积分区间为:[...
被积函数:f(t)=2*lamd/(t^2)*exp(-2*lamd/t)*(1-exp(-2*lamd/t))^4*exp(-2*lamd/(t-c));
积分区间为:[2,无穷大]
对y积分
其中:c=0.000001;lamd=0.001;
y=sym('2*lamd/(t^2)*exp(-2*lamd/t)*(1-exp(-2*lamd/t))^4*exp(-2*lamd/(t-c))');
int(y,t,c,inf)
Warning: Explicit integral could not be found.
我这样在matlab中操作,为什么会出现这个错误?
是对t积分,上面写错了. 展开
积分区间为:[2,无穷大]
对y积分
其中:c=0.000001;lamd=0.001;
y=sym('2*lamd/(t^2)*exp(-2*lamd/t)*(1-exp(-2*lamd/t))^4*exp(-2*lamd/(t-c))');
int(y,t,c,inf)
Warning: Explicit integral could not be found.
我这样在matlab中操作,为什么会出现这个错误?
是对t积分,上面写错了. 展开
4个回答
展开全部
Warning: Explicit integral could not be found.
显式积分不存在
显式积分不存在
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
计算无穷限积分的函数,用Matlab实现。
1、函数quadFromInf用于计算从负无穷大到一个确定值a的积分
%name:quadFromInf.m
function
Isum
=
quadFromInf(fun,a,dx0,tol,method)
if
nargin
<
2
,a=0
;end
if
nargin
<
3
,dx0=0.5
;end
if
nargin
<
4
,tol
=
5e-4
;end
if
nargin
<
5
,method
=
1
;end
j=0;dx
=
dx0;Isum
=
0;x2
=
a;
maxint
=
35;
%fprintf('\n
j
dx
x2
I_j
Isum\n');
while
j<maxint
x1
=
x2
-
dx;
switch
method
case
1,
I
=
quad(fun,x1,x2);
case
2,
I
=
quadl(fun,x1,x2);
otherwise,
error(sprintf('method
=
%d
not
allowed',method));
end
Isum
=
Isum
+
I;
%fprintf('%4d
%8.1f
%8.1f
%12.8f
%12.8f\n',j,dx,x2,I,Isum);
if
j>5
&
abs(I/Isum)
<
tol,break;
end
j
=
j+1;x2
=
x1;dx
=
2*dx;
end
2、函数quadToInf用于计算从一个确定值a到正无穷大的积分。
%name:quadToInf.m
function
Isum
=
quadToInf(fun,a,dx0,tol,method)
if
nargin
<
2
,a=0
;end
if
nargin
<
3
,dx0=0.5
;end
if
nargin
<
4
,tol
=
5e-4
;end
if
nargin
<
5
,method
=
1
;end
j=0;dx
=
dx0;Isum
=
0;x1
=
a;
maxint
=
35;
%fprintf('\n
j
dx
x2
I_j
Isum\n');
while
j<maxint
x2
=
x1
+
dx;
switch
method
case
1,
I
=
quad(fun,x1,x2);
case
2,
I
=
quadl(fun,x1,x2);
otherwise,
error(sprintf('method
=
%d
not
allowed',method));
end
Isum
=
Isum
+
I;
%fprintf('%4d
%8.1f
%8.1f
%12.8f
%12.8f\n',j,dx,x2,I,Isum);
if
j>5
&
abs(I/Isum)
<
tol,break;
end
j
=
j+1;x1
=
x2;dx
=
2*dx;
end
1、函数quadFromInf用于计算从负无穷大到一个确定值a的积分
%name:quadFromInf.m
function
Isum
=
quadFromInf(fun,a,dx0,tol,method)
if
nargin
<
2
,a=0
;end
if
nargin
<
3
,dx0=0.5
;end
if
nargin
<
4
,tol
=
5e-4
;end
if
nargin
<
5
,method
=
1
;end
j=0;dx
=
dx0;Isum
=
0;x2
=
a;
maxint
=
35;
%fprintf('\n
j
dx
x2
I_j
Isum\n');
while
j<maxint
x1
=
x2
-
dx;
switch
method
case
1,
I
=
quad(fun,x1,x2);
case
2,
I
=
quadl(fun,x1,x2);
otherwise,
error(sprintf('method
=
%d
not
allowed',method));
end
Isum
=
Isum
+
I;
%fprintf('%4d
%8.1f
%8.1f
%12.8f
%12.8f\n',j,dx,x2,I,Isum);
if
j>5
&
abs(I/Isum)
<
tol,break;
end
j
=
j+1;x2
=
x1;dx
=
2*dx;
end
2、函数quadToInf用于计算从一个确定值a到正无穷大的积分。
%name:quadToInf.m
function
Isum
=
quadToInf(fun,a,dx0,tol,method)
if
nargin
<
2
,a=0
;end
if
nargin
<
3
,dx0=0.5
;end
if
nargin
<
4
,tol
=
5e-4
;end
if
nargin
<
5
,method
=
1
;end
j=0;dx
=
dx0;Isum
=
0;x1
=
a;
maxint
=
35;
%fprintf('\n
j
dx
x2
I_j
Isum\n');
while
j<maxint
x2
=
x1
+
dx;
switch
method
case
1,
I
=
quad(fun,x1,x2);
case
2,
I
=
quadl(fun,x1,x2);
otherwise,
error(sprintf('method
=
%d
not
allowed',method));
end
Isum
=
Isum
+
I;
%fprintf('%4d
%8.1f
%8.1f
%12.8f
%12.8f\n',j,dx,x2,I,Isum);
if
j>5
&
abs(I/Isum)
<
tol,break;
end
j
=
j+1;x1
=
x2;dx
=
2*dx;
end
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
计算无穷限积分的函数,用Matlab实现。
1、函数quadFromInf用于计算从负无穷大到一个确定值a的积分
%name:quadFromInf.m
function Isum = quadFromInf(fun,a,dx0,tol,method)
if nargin < 2 ,a=0 ;end
if nargin < 3 ,dx0=0.5 ;end
if nargin < 4 ,tol = 5e-4 ;end
if nargin < 5 ,method = 1 ;end
j=0;dx = dx0;Isum = 0;x2 = a; maxint = 35;
%fprintf('\n j dx x2 I_j Isum\n');
while j<maxint
x1 = x2 - dx;
switch method
case 1, I = quad(fun,x1,x2);
case 2, I = quadl(fun,x1,x2);
otherwise, error(sprintf('method = %d not allowed',method));
end
Isum = Isum + I;
%fprintf('%4d %8.1f %8.1f %12.8f %12.8f\n',j,dx,x2,I,Isum);
if j>5 & abs(I/Isum) < tol,break; end
j = j+1;x2 = x1;dx = 2*dx;
end
2、函数quadToInf用于计算从一个确定值a到正无穷大的积分。
%name:quadToInf.m
function Isum = quadToInf(fun,a,dx0,tol,method)
if nargin < 2 ,a=0 ;end
if nargin < 3 ,dx0=0.5 ;end
if nargin < 4 ,tol = 5e-4 ;end
if nargin < 5 ,method = 1 ;end
j=0;dx = dx0;Isum = 0;x1 = a; maxint = 35;
%fprintf('\n j dx x2 I_j Isum\n');
while j<maxint
x2 = x1 + dx;
switch method
case 1, I = quad(fun,x1,x2);
case 2, I = quadl(fun,x1,x2);
otherwise, error(sprintf('method = %d not allowed',method));
end
Isum = Isum + I;
%fprintf('%4d %8.1f %8.1f %12.8f %12.8f\n',j,dx,x2,I,Isum);
if j>5 & abs(I/Isum) < tol,break; end
j = j+1;x1 = x2;dx = 2*dx;
end
1、函数quadFromInf用于计算从负无穷大到一个确定值a的积分
%name:quadFromInf.m
function Isum = quadFromInf(fun,a,dx0,tol,method)
if nargin < 2 ,a=0 ;end
if nargin < 3 ,dx0=0.5 ;end
if nargin < 4 ,tol = 5e-4 ;end
if nargin < 5 ,method = 1 ;end
j=0;dx = dx0;Isum = 0;x2 = a; maxint = 35;
%fprintf('\n j dx x2 I_j Isum\n');
while j<maxint
x1 = x2 - dx;
switch method
case 1, I = quad(fun,x1,x2);
case 2, I = quadl(fun,x1,x2);
otherwise, error(sprintf('method = %d not allowed',method));
end
Isum = Isum + I;
%fprintf('%4d %8.1f %8.1f %12.8f %12.8f\n',j,dx,x2,I,Isum);
if j>5 & abs(I/Isum) < tol,break; end
j = j+1;x2 = x1;dx = 2*dx;
end
2、函数quadToInf用于计算从一个确定值a到正无穷大的积分。
%name:quadToInf.m
function Isum = quadToInf(fun,a,dx0,tol,method)
if nargin < 2 ,a=0 ;end
if nargin < 3 ,dx0=0.5 ;end
if nargin < 4 ,tol = 5e-4 ;end
if nargin < 5 ,method = 1 ;end
j=0;dx = dx0;Isum = 0;x1 = a; maxint = 35;
%fprintf('\n j dx x2 I_j Isum\n');
while j<maxint
x2 = x1 + dx;
switch method
case 1, I = quad(fun,x1,x2);
case 2, I = quadl(fun,x1,x2);
otherwise, error(sprintf('method = %d not allowed',method));
end
Isum = Isum + I;
%fprintf('%4d %8.1f %8.1f %12.8f %12.8f\n',j,dx,x2,I,Isum);
if j>5 & abs(I/Isum) < tol,break; end
j = j+1;x1 = x2;dx = 2*dx;
end
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
好难
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询