double integral with one indefined variable
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Mike Hosea
le 1 Mar 2013
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 commentaires
Walter Roberson
le 28 Fév 2013
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 commentaires
Voir également
Catégories
En savoir plus sur Bessel functions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!