can I find a solution for this integral?

1 回表示 (過去 30 日間)
Shreen El-Sapa
Shreen El-Sapa 2021 年 8 月 3 日
コメント済み: Shreen El-Sapa 2021 年 8 月 4 日
r=sqrt(x.^2+y.^2);
theta=atan2(y,x);
ab1=1;xi=2;n=10;
h=@(t) (t.*(exp(-xi.*(r.*cos(theta)+ab1))-exp(-t.*(r.*cos(theta)+ab1))).*((-1).^(n-1).*exp(-ab1.*t)./factorial( n )).*t.*besselj(1,t.*r.*sin(theta)));
integral(h, 0, inf)
  7 件のコメント
Shreen El-Sapa
Shreen El-Sapa 2021 年 8 月 3 日
i will use this notation and recalculate it.
thanks so much
Shreen El-Sapa
Shreen El-Sapa 2021 年 8 月 4 日
in this case it excuted but i wanted to use the values in the lines 17 and 18 it failed
syms t real
a = 1 ; %RADIUS
L=.4;
c =-a/L;
b =a/L;
m =a*200; % NUMBER OF INTERVALS
[x,y]=meshgrid([c:(b-c)/m:b],[c:(b-c)/m:b]');
[I J]=find(sqrt(x.^2+y.^2)<(a-.1));
if ~isempty(I)
x(I,J) = 0;
y(I,J) = 0;
end
r = sqrt(x.^2+y.^2);
theta = atan2(y,x);
ab1=1; xi=2; n=10; k=2;
% I want to use the following green lines instead of above values of ab1=1; xi=2; n=10; k=2;
%chi=1;alpha=1;ab1=1;
%k=sqrt(chi.^2+alpha.^2);xi=sqrt(t.^2+k.^2);
h=@(t)(t-xi).^(-1).* (t.*(exp(-xi.*(r.*cos(theta)+ab1))-exp(-t.*(r.*cos(theta)+ab1))).*(((-1).^(n-1).*t.^(n-1).*exp(-ab1.*t)./factorial( n ))+((-1).^(n).*sqrt(pi.*k./2./t.^2).*exp(-ab1.*xi).*gegenbauerC(n,-1./2, xi./k))).*t.*besselj(1,t.*r.*sin(theta)));
hint = integral(h, 0, inf, 'ArrayValued', true)

サインインしてコメントする。

採用された回答

Dave B
Dave B 2021 年 8 月 3 日
When I run this code with scalar x,y it works fine:
x=2;y=2;
r=sqrt(x.^2+y.^2);
theta=atan2(y,x);
ab1=1;xi=2;n=10;
h=@(t) (t.*(exp(-xi.*(r.*cos(theta)+ab1))-exp(-t.*(r.*cos(theta)+ab1))).*((-1).^(n-1).*exp(-ab1.*t)./factorial( n )).*t.*besselj(1,t.*r.*sin(theta)));
integral(h, 0, inf)
When I run this code with vector x and y it fails:
x=[1 2];y=[1 2];
r=sqrt(x.^2+y.^2);
theta=atan2(y,x);
ab1=1;xi=2;n=10;
h=@(t) (t.*(exp(-xi.*(r.*cos(theta)+ab1))-exp(-t.*(r.*cos(theta)+ab1))).*((-1).^(n-1).*exp(-ab1.*t)./factorial( n )).*t.*besselj(1,t.*r.*sin(theta)));
integral(h, 0, inf)
"For scalar-valued problems, the function y = fun(x) must accept a vector argument, x, and return a vector result, y. This generally means that fun must use array operators instead of matrix operators. For example, use .* (times) rather than * (mtimes). If you set the 'ArrayValued' option to true, then fun must accept a scalar and return an array of fixed size."
Here, your function accepts a scalar argument (t) and returns an array:
size(h(0)) == size(r); % for all scalar h, for all size(r) (at least that I tested)
"Set this flag to true or 1 to indicate that fun is a function that accepts a scalar input and returns a vector, matrix, or N-D array output."
Thus, if x and y are arrays, do you want the following?
integral(h, 0, inf, 'ArrayValued', true)
  2 件のコメント
Shreen El-Sapa
Shreen El-Sapa 2021 年 8 月 3 日
thanks so much
Shreen El-Sapa
Shreen El-Sapa 2021 年 8 月 4 日
in this case it excuted but i wanted to use the values in the lines 17 and 18 it failed
syms t real
a = 1 ; %RADIUS
L=.4;
c =-a/L;
b =a/L;
m =a*200; % NUMBER OF INTERVALS
[x,y]=meshgrid([c:(b-c)/m:b],[c:(b-c)/m:b]');
[I J]=find(sqrt(x.^2+y.^2)<(a-.1));
if ~isempty(I)
x(I,J) = 0;
y(I,J) = 0;
end
r = sqrt(x.^2+y.^2);
theta = atan2(y,x);
ab1=1; xi=2; n=10; k=2;
% I want to use the following green lines instead of above values of ab1=1; xi=2; n=10; k=2;
%chi=1;alpha=1;ab1=1;
%k=sqrt(chi.^2+alpha.^2);xi=sqrt(t.^2+k.^2);
h=@(t)(t-xi).^(-1).* (t.*(exp(-xi.*(r.*cos(theta)+ab1))-exp(-t.*(r.*cos(theta)+ab1))).*(((-1).^(n-1).*t.^(n-1).*exp(-ab1.*t)./factorial( n ))+((-1).^(n).*sqrt(pi.*k./2./t.^2).*exp(-ab1.*xi).*gegenbauerC(n,-1./2, xi./k))).*t.*besselj(1,t.*r.*sin(theta)));
hint = integral(h, 0, inf, 'ArrayValued', true)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by