필터 지우기
필터 지우기

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 CenterFile Exchange에서 Get Started with Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by