Error in double integration
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Athira T Das
el 18 de Abr. de 2023
Editada: Athira T Das
el 25 de Abr. de 2023
I need to evaluate a double integration but showing some error
lam=532*10^-9;
z=100;
k=2*pi/lam;
omega=30;s=5;
r=linspace(0,100,100);
w0=0.002;m=1;rho=1;p=1;
E = 1./(w0^2) + (1i*k)./(2*z);
Con1=(1i./(2*lam*z))*exp((omega^2./2 + r.^2 + omega)./E).*exp((-1i.*k.*r.^2)./(2*z)).*(pi./E).*(1./(2*1i*sqrt(E)))^m;
Con2=(1i./(2*lam*z))*exp((omega^2./2 + r.^2 + omega)./conj(E)).*exp((-1i.*k.*r.^2)./(2*z)).*(pi./conj(E)).*(1./(2*1i*sqrt(conj(E)))).^m;
syms ph phi
for l=0:m
E0 = Con1.*((exp(-r.*(cos(ph)+sin(ph))).*hermiteH(l,1i*(omega./2 - r*cos(ph))./sqrt(E)).*hermiteH(m-l,1i*(omega./2 - r*sin(ph))./sqrt(E))) - (exp(r.*(cos(ph)+sin(ph))).*hermiteH(l,-1i*(omega./2 + r*cos(ph))./sqrt(E)).*hermiteH(m-l,-1i*(omega./2 + r*sin(ph))./sqrt(E))));
E0s = Con2.*((exp(-r.*(cos(phi)+sin(phi))).*hermiteH(l,1i*(omega./2 - r*cos(phi))./sqrt(conj(E))).*hermiteH(m-l,1i*(omega./2 - r*sin(phi))./sqrt(conj(E)))) - (exp(r.*(cos(phi)+sin(phi))).*hermiteH(l,-1i*(omega./2 + r.*cos(phi))./sqrt(conj(E))).*hermiteH(m-l,-1i*(omega./2 + r*sin(phi))./sqrt(conj(E)))));
I = ((1i*p).^(m-l)).*nchoosek(m,l).*E0.*E0s.*exp(-1i.*s.*(ph-phi)).*exp(((-2.*r.^2)-(2.*r.^2.*cos(phi-ph)))./(rho.^2));
end
IQ = I;
ph_min = 0;
ph_max = 2*pi;
phi_min = 0;
phi_max = 2*pi;
fun = matlabFunction(IQ,'Vars',[ph,phi]);
result = integral2(fun, ph_min, ph_max, phi_min, phi_max);
0 comentarios
Respuesta aceptada
Torsten
el 22 de Abr. de 2023
Editada: Torsten
el 22 de Abr. de 2023
syms r ph phi
lam=532*10^-9;
z=100;
k=2*pi/lam;
omega=30;
w0=0.002;m=1;rho=1;p=1;
E = 1./(w0^2) + (1i*k)./(2*z);
Con1=(1i./(2*lam*z))*exp((omega^2./2 + r.^2 + omega)./E).*exp((-1i.*k.*r.^2)./(2*z)).*(pi./E).*(1./(2*1i*sqrt(E)))^m;
Con2=(1i./(2*lam*z))*exp((omega^2./2 + r.^2 + omega)./conj(E)).*exp((-1i.*k.*r.^2)./(2*z)).*(pi./conj(E)).*(1./(2*1i*sqrt(conj(E)))).^m;
for l=0:m
E0 = Con1.*((exp(-r.*(cos(ph)+sin(ph))).*hermiteH(l,1i*(omega./2 - r*cos(ph))./sqrt(E)).*hermiteH(m-l,1i*(omega./2 - r*sin(ph))./sqrt(E))) - (exp(r.*(cos(ph)+sin(ph))).*hermiteH(l,-1i*(omega./2 + r*cos(ph))./sqrt(E)).*hermiteH(m-l,-1i*(omega./2 + r*sin(ph))./sqrt(E))));
E0s = Con2.*((exp(-r.*(cos(phi)+sin(phi))).*hermiteH(l,1i*(omega./2 - r*cos(phi))./sqrt(conj(E))).*hermiteH(m-l,1i*(omega./2 - r*sin(phi))./sqrt(conj(E)))) - (exp(r.*(cos(phi)+sin(phi))).*hermiteH(l,-1i*(omega./2 + r.*cos(phi))./sqrt(conj(E))).*hermiteH(m-l,-1i*(omega./2 + r*sin(phi))./sqrt(conj(E)))));
I = ((1i*p).^(m-l)).*nchoosek(m,l).*E0.*E0s.*exp(-1i.*l.*(ph-phi)).*exp(((-2.*r.^2)-(2.*r.^2.*cos(phi-ph)))./(rho.^2));
end
IQ = I;
ph_min = 0;
ph_max = 2*pi;
phi_min = 0;
phi_max = 2*pi;
fun = matlabFunction(IQ,'Vars',[ph,phi,r]);
r_array = linspace(0,10,100);
result = arrayfun(@(r)integral2(@(ph,phi)fun(ph,phi,r),ph_min, ph_max, phi_min, phi_max),r_array)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Particle & Nuclear Physics en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!