# numerical integration of exponential which contains complex function

I would like to get the result of Fresnel-Kirchhoff integral in paraxial approximation to the cylindrical diffracted wave and here is a part of my code and if it is solved gonna be carrying the other parts out. It is a Matlab code.

vpa(int(exp(-1i*2*k*(n_cl-n_s)*sqrt(b^2-x_p^2))*exp(1i*k*((x-x_p)^2)/2z),-b,-a))


with respect to x_p. where

b = 62.5*e-6; % cladding radius
a = 4*e-6; % core radius
n_co = 1.473; % core ref index
n_cl = n_co - 0.016; % cladding ref index
n_s  = 1.37868e-5; % surrounding ref index
L = 457.9e-9; % wavelength
k = 2*pi/L; % wavenumber
z = 0.4 ;
x =-0.0002;


Which command should be used as an integrator? I've been trying to use int() instead of quad since quad doesn't fulfill the requirement to obtain complex results. In addition to that I've been getting the well-known error of

Explicit integral could not be found


The int function (more precisely sym/int) is mainly designed for symbolic integration. When it cannot obtain a symbolic result it will attempt a numeric solution using MuPAD's numeric::int. I don't know why this won't evaluate to a numeric result, but you can use MuPAD's numeric::quadrature, which underlies numeric::int:

evalin(symengine,'numeric::quadrature(exp(-(pi*(4722366482869645/1208925819614629174706176 - x_p^2)^(1/2)*55043382873750776053760*i)/4324743225012021)*exp(((x_p + 1/5000)^2*7366803725989309*i)/2684354560), x_p == -1/16000..-4722366482869645/1180591620717411303424)')


However, based on all of your floating-point parameter values, I'd imagine that a numeric quadrature-based solution is what you're actually looking for. You should be using integral (or possibly quadgk in older versions of Matlab):

integral(@(x_p)exp(-1i*2*k*(n_cl-n_s)*sqrt(b^2-x_p.^2)).*exp(1i*k*((x-x_p).^2)/2*z),-b,-a)


Results returned by both methods agree with each other.

NOTE: there's a typo in your equation. I've assumed that you meant ...)/2*z as opposed to ...)/(2*z).

• thanks a lot . I will try to use quadgk. It is accurate to say that quadgk works. – cgnization Oct 28 '14 at 0:56