File Exchange

image thumbnail

MatScat

version 1.4.0.0 (56 KB) by Jan Schäfer
Solve the scattering of electromagnetic radiation by a sphere or multiple cylinders.

45 Downloads

Updated 04 Jan 2016

View License

MatScat is a MATLAB package which contains different solutions for the
scattering of electromagnetic radiation by a sphere (Mie theory) or an
infinite circular cylinder. Most of the code has been developed during my PhD
work [3]. The multiple cylinder near field solution has been implemented
afterwards and has been presented in a seperate publication [4].
-----------------------------------------------------------------------------
Make sure that the root folder and the folders '/bessel', '/expcoeff' and
'/util' are in the Matlab-Path. The files in '/test' can be run to check if
everything works fine.

The functions to start the calculation can be found in the root folder.
These are:

calccyl.m - calculate the far field solution for a single (stratified) cylinder
calccyl_nf.m - calculate the near field solution for a single (stratified) cylinder
calccyl_multi.m - calculate the far field solution for multiple cylinders
calccyl_multi_nf.m - calculate the near field solution for multiple cylinders
calcmie.m - calculate the far field solution for a single (stratified) sphere
calcmie_nf.m - calculate the near field solution for a single (stratified) sphere

-----------------------------------------------------------------------------

If you use these functions in your research work please cite my work [3,4].
Please also cite the theoretical work underlying my implementation which is:
calccyl, calccyl_nf, calcmie and calcmie_nf are implemented based on [1].
calccyl_multi and calccyl_multi_nf are implemented based on [2,4].
The stratified cylinder/sphere solution is implemented based on [1,5].

-----------------------------------------------------------------------------
[1] Bohren, C. F. and Huffman, D. R., Absorption and scattering of light by
small particles, Wiley-Interscience, New York, 1998.

[2] Lee, S.-C., Dependent scattering of an obliquely incident plane wave by a
collection of parallel cylinders. J. Appl. Phys. 68(10), 1990.

[3] Schäfer, J.-P.,Implementierung und Anwendung analytischer und numerischer
Verfahren zur Lösung der Maxwellgleichungen für die Untersuchung der
Lichtausbreitung in biologischem Gewebe, PhD thesis, Univerität Ulm, 2011,
http://vts.uni-ulm.de/doc.asp?id=7663

[4] Schäfer, J. and Lee, S.-C. and Kienle, A,, Calculation of the near
fields for the scattering of electromagnetic waves by multiple infinite
cylinders at perpendicular incidence, J. Quant. Spectrosc. Radiat. Trans.
113(16), 2012.

[5] Kerker, M., The scattering of light and other electromagnetic
radiation, Academic Press, 1969
-----------------------------------------------------------------------------

If you have questions or remarks about the MatScat package or if you find any
bugs in the code please send an email to jan.schaefer(at)maxwellsolutions.de.

Take a look at my website at http://www.maxwellsolutions.de.

Have fun!

-----------------------------------------------------------------------------
Copyright 2012 Jan Schäfer, Institut für Lasertechnologien (ILM)
Author: Jan Schäfer (jan.patrick.schaefer(at)gmail.com)
Organization: Institut für Lasertechnologien in der Medizin und Meßtechnik an
der Universität Ulm (http://www.ilm-ulm.de)
-----------------------------------------------------------------------------

Comments and Ratings (16)

kim yu

kim yu (view profile)

Thank you. It's a great help to me.This code is very interesting.

Dear Dr. Schäfer, thanks for sharing your code in the public domain. With its clarity, simplicity, it helps me a lot understanding the Mie code! Well done!

However I got a problem in understanding the near-field enhancement result. By executing the file test_calcmie_nf.m, I got the Poynting amplitude (intensity) in the x-y plain, for lamda = 800nm and R_np = 50 nm. By normalizing the intensity to the incident intensity, which I calculated from the formula E0^2*n_m/Z0=3.53e-3. Here, E0 is the incident E-field in x polarization direction, n_m is the refractive index in water and Z0 is the wave impedance in vacuum. After doing so, I have a maximum near-field enhancement about 1.3, which is far below the value of 20 calculated from this source: Tejerina et.al. (2014), "Nanosphere Optics Lab Field Simulator,“ https://nanohub.org/resources/nsoptics3D, DOI: 10.4231/D3FF3M064. I'm thinking where comes the discrepancy... I check the codes. Everything seems O.K.

Looking forward to your reply.

Joe

Uni Luebeck

an excellent working, thanks very much!

Simbathree

This is absolutely a 5 star work!
I haven't used it yet , but the code style is really fascinating!

roy nicolas

This help me a lot in my research. Thank you very much.

Sina Talebi

juzimm

juzimm (view profile)

mcrane

mcrane (view profile)

My apologies, I had a mistake in my code! Please ignore my comment in August 2014, the bessel functions are properly calculated.

It seems to be a bug in expcoeff_mie( x, m, conv ) using Octave

x = 0.0010000
xix =

Columns 1 through 3:

3.3333e-07 - 1.0000e+03i 2.6645e-10 - 3.0000e+06i

the second order differs from wolfram alpha SphericalHankelH1[2, 0.001]*0.001 = 6.66667 × 10^-11 -3.00000 × 10^6 i

imanol uria

Hi Jan,

I´m a student and I´m using your programmes. They´re fantastics! I have one question: I´m plotting the maps of the near field for a single sphere, and I want to plot not the total |E| but |E|/|Eincoming|. I can´t find the value of Eincoming in the programmes, if you can help me...

Thank you for your attention!

M Santos

Can anybody explain this? (in test_calcmie). What is fctr?

%% Differential scattering cross sections
fctr = 2/pi/C.k;
dCsdOp = fctr*squeeze(abs(S(1,1,:).^2)); % parallel
dCsdOn = fctr*squeeze(abs(S(2,2,:).^2)); % perpendicular
dCsdO = 0.5*(dCsdOp + dCsdOn); % unpolarized

mcrane

mcrane (view profile)

I believe the derivatives of the Ricatti-Bessel functions are implemented incorrectly. When differentiating by parts, the sqrt(pi/(2x)) term on the spherical bessel functions is left out when dbesselj is called.

mcrane

mcrane (view profile)

RICARDO

I downloaded and extract this code and when I tried to run the tests from the test directory, I have got the following messages:

>> test_calccyl
Undefined function 'dbesselj' for input arguments of type 'double'.

Error in expcoeff_cyl (line 47)
djneta = dbesselj(n, eta);

Error in calccyl (line 91)
[anp, ann, bnp, bnn] = expcoeff_cyl(x, m, zeta, 1, conv);

Error in test_calccyl (line 30)
[T, C, ang] = calccyl(dia/2., ns, nm, lambda, nang, zeta);

>> test_calccyl_multi
Undefined function 'dbesselj' for input arguments of type 'double'.

Error in expcoeff_cyl (line 47)
djneta = dbesselj(n, eta);

Error in calccyl (line 91)
[anp, ann, bnp, bnn] = expcoeff_cyl(x, m, zeta, 1, conv);

Error in test_calccyl_multi (line 25)
[ Ts, Cs, angs ] = calccyl( dia/2., ns, nm, lambda, nang);

Undefined function 'calccyl_nf' for input arguments of type 'double'.

Error in test_calccyl_nf (line 45)
[Ep, En, Hp, Hn, Sp, Sn, T, C, ang] = calccyl_nf(dia/2., ns, nm, ...

>> test_calccyl_nf_multi
Undefined function 'calccyl_nf' for input arguments of type 'double'.

Error in test_calccyl_nf_multi (line 53)
[ Ep1, En1, Hp1, Hn1, Sp1, Sn1, T1, C1, ang1] = calccyl_nf( dia/2., ...

>> test_calcmie
Undefined function 'calcmie' for input arguments of type 'double'.

Error in test_calcmie (line 30)
[S, C, ang] = calcmie(rad, ns, nm, lambda, nang, ...

>> test_calcmie_nf
Undefined function 'calcmie_nf' for input arguments of type 'double'.

Error in test_calcmie_nf (line 49)
[E, H, P, S, C, ang] = calcmie_nf(dia/2., ns, nm, ...

Is anything that I have to update?

Jakub

Jakub (view profile)

Thank you for the submission. While I don't want go through the theory behind I want to make myselft sure about the interpretation of the results for the near field solution. Light is incident upon the particle from the z direction, the particle is placed in [0,0,0], right?

So if I want to obtain solution of the Efield in the plane behind the sphere with radius 25um, I have to set all values of zf to 25 um (file test_calcmie_nf.m). Is this correct?

Thank you in advance.

Updates

1.4.0.0

changed contact information, added website

1.4.0.0

edited contact information

1.4.0.0

- dependency on Wavelet Toolbox removed
- adapted for MATLAB R2012b

1.3.0.0

Near and far field solutions for n-layered (stratified, coated) particles (single cylinder and sphere) added.

1.2.0.0

Error in asmmie.m for calculation of cross sections corrected.
Test case from Bohren book added in test_calccyl.m

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor

bessel/

expcoeff/

test/

util/