version 1.4.0.0 (56 KB) by
Jan Schäfer

Solve the scattering of electromagnetic radiation by a sphere or multiple cylinders.

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)

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

Jan Schäfer (2020). MatScat (https://www.mathworks.com/matlabcentral/fileexchange/36831-matscat), MATLAB Central File Exchange. Retrieved .

Created with
R2011b

Compatible with any release

**Inspired:**
to generate 16 combination of 1 and -1, Mie Electric Field Simulation for Spheres, IMPLEMENTATION OF FIXED POINT THEORY ON IMAGE INTEGRITY AUTHENTICATION, verify_magic( A )

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

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

Edwin BellerMark MolenaarMark MolenaarSaúl Antonio Rosales MendozaHoma Bayatshuai wangRefet Ali YALCINThank you for sharing this code with us.

The codes in asmcyl.m should change. The present form in v 1.4 is this;

C.sca(1) = 4/k*(abs(bnp(1)).^2 + 2*sum(abs(bnp(2:end)).^2));

C.sca(2) = 4/k*(abs(ann(1)).^2 + 2*sum(abs(ann(2:end)).^2));

it should be like this:

C.sca(1) = 4/k*(abs(bnp(1)).^2 + 2*sum(abs(bnp(2:end)).^2+abs(anp(2:end)).^2));

C.sca(2) = 4/k*(abs(ann(1)).^2 + 2*sum(abs(ann(2:end)).^2+abs(bnn(2:end)).^2));

Zhihao WuDear Jan Schäfer, thank you for your excellent work and it helps a lot in my graduation project. However, I found there is a small mistake in the calculation of scattering coefficient a extinction coefficient. in the file 'assmie.m'. The error happens on the 44th and 45th row, where the corrected code should be 'C.ext = 2/x^2*sum(n2.*real(an + bn));' and 'C.sca = 2/x^2*sum(n2.*(abs(an).^2 + abs(bn).^2));'. And don't forget to import variable x given by 'x=k*r' in 'calcmie.m' into 'asmmie.m' before running the modified code. I modified the code on my PC and verified the result by comparing the one given by online mie theory calculator found on 'https://omlc.org/calc/mie_calc.html' and the result can match with the modification aforementioned applied.

Best regards!

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

Xiaoxuan LiangDear 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

yingying qiaoan excellent working, thanks very much!

SimbathreeThis is absolutely a 5 star work!

I haven't used it yet , but the code style is really fascinating!

roy nicolasJunard LandinginThis help me a lot in my research. Thank you very much.

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

Konstantin LadutenkoIt 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 uriaHi 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 SantosCan 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

mcraneI 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.

mcraneRICARDOI 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?

JakubThank 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.