double integral with one indefined variable
1 次查看(过去 30 天)
显示 更早的评论
I'm trying to calculate the integral:
m1=0.00098;
m2=0.91426;
lambidazero=659.57;
sigma=10.981;
deltan=-0.59;
r=1;
x from 500 until 750 and ro from 0 until r
final=@(x,ro)(m1+m2.*exp(-((x-lambidazero).^2)./((sigma).^2))).*(exp((-i.*deltan.*2.*pi.*(((r.^2)-(ro.^2)).^(1./2)))./(x))).*bessel0(z.*ro).*ro;
I need the result as a function of z because I need plot final as function of z.
I try to do:
q = integral2(final,660,700,0,1) but doesn't work.
somebody can help me?
thanks
0 个评论
回答(2 个)
Mike Hosea
2013-3-1
I don't know what bessel0 is, so I just substituted atan() below, but this the way you would do that with numerical integration. Notice that final() is now a function of 3 variables. It is easiest to first define a function that will only accept a scalar z value and then use arrayfun to make it work with arrays of z values.
m1=0.00098;
m2=0.91426;
lambidazero=659.57;
sigma=10.981;
deltan=-0.59;
r=1;
% x from 500 until 750 and ro from 0 until r
final = @(x,ro,z)(m1 + m2.*exp(-((x-lambidazero).^2)./((sigma).^2))) ...
.* (exp((-1i.*deltan.*2.*pi.*(((r.^2)-(ro.^2)).^(1./2)))./(x))) ...
.* atan(z.*ro).*ro;
fscalar = @(z)integral2(@(x,y)final(x,y,z),500,750,0,r);
% The function fscalar(z) can only accept a scalar value for z.
% Use arrayfun to make a function that accepts vectors.
f = @(z)arrayfun(fscalar,z);
% Now plot f just as you would any function in MATLAB
x = 0:0.1:1;
y = f(x);
plot(x,y)
0 个评论
Walter Roberson
2013-2-28
If the result you are expecting needs to contain a variable, then you cannot use numeric integration for the process. Instead you must use symbolic integration by way of the Symbolic toolbox.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Bessel functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!