double integral with one indefined variable

조회 수: 1 (최근 30일)
izabela
izabela 2013년 2월 28일
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

답변 (2개)

Mike Hosea
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)

Walter Roberson
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.

카테고리

Help CenterFile Exchange에서 Bessel functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by