├── README.md ├── Mie_Scattering_and_Absorption_Sphere.m └── Permittivity_Silver_JohnsonChristy.txt /README.md: -------------------------------------------------------------------------------- 1 | # Mie_Scattering_and_Absorption_Sphere 2 | 3 | This script reads the relative permittivity data of a material and uses Mie theory to compute the scattering, absorption, and extinction cross-sections for a spherical particle of that material embedded in a lossless medium. 4 | The permittivity file has to be a tab-delimited text file with three columns: energy (in eV), epsilon1, epsilon2 5 | 6 | An example of relative permittivity for silver is provided in "Permittivity_Silver_JohnsonChristy.txt" 7 | 8 | [![View Mie_Scattering_and_Absorption_Sphere on File Exchange](https://www.mathworks.com/matlabcentral/images/matlab-file-exchange.svg)](https://nl.mathworks.com/matlabcentral/fileexchange/110165-mie_scattering_and_absorption_sphere) 9 | -------------------------------------------------------------------------------- /Mie_Scattering_and_Absorption_Sphere.m: -------------------------------------------------------------------------------- 1 | % Baldi Lab 15/04/2022 2 | % This script reads the relative permittivity data of a material and uses 3 | % Mie theory to compute the scattering, absorption, and extinction 4 | % cross-sections for a spherical particle of that material embedded in a 5 | % lossless medium. The permittivity file has to be a tab-delimited text 6 | % file with three columns: energy (in eV), epsilon1, epsilon2 7 | clear all 8 | close all 9 | 10 | % MANUAL INPUT 11 | prompt = {'Sphere radius (nm)','Refractive index of the surrounding medium (air = 1, water = 1.333)'}; 12 | dlg_title = 'Input parameters'; 13 | num_lines = 1; 14 | def = {'',''}; 15 | answer = inputdlg(prompt,dlg_title,num_lines,def); 16 | r=str2double(answer{1}); 17 | index=str2double(answer{2}); 18 | 19 | % DEFAULT SETTINGS 20 | Esteps = 1000; % Number of energy steps for the data interpolation 21 | nmax = 10; % Maximum order of the Bessel function 22 | 23 | % CALCULATIONS 24 | read=dlmread(uigetfile('*','Select a dielectric function file')); % Load the permittivity file (energy in eV, eps1, eps2) 25 | e = 1.60217646e-19; % Elementary charge in SI units 26 | h = 6.626068e-34; % Planck's constant in SI units 27 | hbar = 1.05457148e-34; % hbar in SI units 28 | me = 9.10938215e-31; % Electron rest mass in SI units 29 | c = 2.99792458e8; % Light speed in SI units 30 | 31 | %Load Experimental data 32 | eV_read=read(:,1); 33 | e1_read=read(:,2); 34 | e2_read=read(:,3); 35 | Emin=eV_read(1); 36 | Emax=eV_read(size(eV_read,1)); 37 | 38 | %Interpolates the tabulated experimental data to make the data set smooth 39 | energy = (Emin:(Emax-Emin)/Esteps:Emax)'; 40 | e1_read = interp1(eV_read, e1_read, energy, 'spline'); 41 | e2_read = interp1(eV_read, e2_read, energy, 'spline'); 42 | 43 | %Converts the frequency data to wavelength in meters 44 | lambda = h*c./(e*energy); 45 | 46 | %Creates the wavenumber k 47 | k = 2*pi*index./lambda; 48 | 49 | %Creates the total permittivity values of the particle and the medium 50 | n_read = (((e1_read.^2 + e2_read.^2).^(1/2) + e1_read)./2).^(1/2); 51 | k_read = (((e1_read.^2 + e2_read.^2).^(1/2) - e1_read)./2).^(1/2); 52 | etot_read = n_read + 1i*k_read; 53 | emed= (index^2)*ones(size(etot_read)); 54 | m=etot_read./index; 55 | 56 | radius = r*1e-9; % Convertion to meters 57 | x = k.*radius; % Size parameter 58 | mx = m.*x; 59 | scaele = 0; % initialise scattering matrix element 60 | extele = 0; % initialise extinction matrix element 61 | for n=1:nmax 62 | jnx = sqrt(pi./(2.*x)).*besselj(n+0.5,x); 63 | jnminx = sqrt(pi./(2.*x)).*besselj(n-0.5,x); 64 | jnmx = sqrt(pi./(2.*mx)).*besselj(n+0.5,mx); 65 | jnminmx = sqrt(pi./(2.*mx)).*besselj(n-0.5,mx); 66 | hnx = sqrt(pi./(2.*x)).*besselh(n+0.5,x); 67 | hnminx = sqrt(pi./(2.*x)).*besselh(n-0.5,x); 68 | xjnxdiff = x.*jnminx - n.*jnx; 69 | mxjnmxdiff = mx.*jnminmx - n.*jnmx; 70 | xhnxdiff = x.*hnminx - n.*hnx; 71 | an = (m.^2.*jnmx.*xjnxdiff-jnx.*mxjnmxdiff)./(m.^2.*jnmx.*xhnxdiff-hnx.*mxjnmxdiff); 72 | bn = (jnmx.*xjnxdiff-jnx.*mxjnmxdiff)./(jnmx.*xhnxdiff-hnx.*mxjnmxdiff); 73 | scaele = scaele + (2*n+1).*(an.*conj(an)+bn.*conj(bn)); 74 | extele = extele + (2*n+1).*real(an+bn); 75 | end 76 | 77 | % Calculates scattering, extinction, and absorption cross sections 78 | Csca = 2*pi./(k.^2).*scaele; 79 | Cext = 2*pi./(k.^2).*extele; 80 | Cabs = Cext-Csca; 81 | 82 | % Calculates scattering, extinction, and absorption efficiencies 83 | Qsca = Csca./(pi*radius^2); 84 | Qext = Cext./(pi*radius^2); 85 | Qabs = Cabs./(pi*radius^2); 86 | 87 | % Plots 88 | % Relative permittivity 89 | figure(1) 90 | hold on 91 | plot(read(:,1),read(:,2),'ok') 92 | plot(read(:,1),read(:,3),'or') 93 | plot(energy, e1_read,'k','linewidth',2); 94 | plot(energy, e2_read,'r','linewidth',2); 95 | xlabel ('energy (eV)', 'FontSize',10); 96 | title ('relative permittivity, \epsilon', 'FontSize',10); 97 | leg1=legend('epsilon1 - data','epsilon2 - data','epsilon1 - interpolated','epsilon2 - interpolated','Location','SouthEast'); 98 | 99 | % Scattering 100 | figure (2) 101 | hold on 102 | plot(energy,Csca,'k','linewidth',2); 103 | yline(pi*radius^2,'--'); 104 | xlabel('energy (eV)', 'FontSize',10); 105 | title(['scattering cross-section of a ', num2str(radius*1E9), ' nm radius sphere'], 'FontSize',10); 106 | leg1=legend('scattering cross-section','geometric cross-section'); 107 | 108 | % Absorption 109 | figure (3) 110 | hold on 111 | plot(energy,Cabs,'k','linewidth',2); 112 | yline(pi*radius^2,'--'); 113 | xlabel('energy (eV)', 'FontSize',10); 114 | title(['absorption cross-section of a ', num2str(radius*1E9), ' nm radius sphere'], 'FontSize',10); 115 | leg1=legend('absorption cross-section','geometric cross-section'); 116 | 117 | % Extinction 118 | figure (4) 119 | hold on 120 | plot(energy,Cext,'k','linewidth',2); 121 | yline(pi*radius^2,'--'); 122 | xlabel('energy (eV)', 'FontSize',10); 123 | title(['extinction cross-section of a ', num2str(radius*1E9), ' nm radius sphere'], 'FontSize',10); 124 | leg1=legend('extinction cross-section','geometric cross-section'); 125 | -------------------------------------------------------------------------------- /Permittivity_Silver_JohnsonChristy.txt: -------------------------------------------------------------------------------- 1 | 0.640 -198.18879086 6.75839962 2 | 0.670 -184.87525623 6.02039189 3 | 0.700 -171.56172159 5.28238416 4 | 0.730 -158.24818696 4.54437642 5 | 0.760 -144.93465233 3.80636869 6 | 0.790 -134.07927748 3.40211209 7 | 0.820 -124.49363898 3.17025109 8 | 0.850 -114.90800047 2.93839010 9 | 0.880 -105.32236197 2.70652910 10 | 0.910 -98.37413244 2.47007532 11 | 0.939 -92.82936421 2.23117756 12 | 0.969 -87.28459598 1.99227980 13 | 0.999 -81.73982775 1.75338203 14 | 1.029 -76.58849953 1.51384204 15 | 1.059 -72.30442431 1.27288639 16 | 1.089 -68.02034909 1.03193074 17 | 1.119 -63.73627387 0.79097509 18 | 1.149 -59.85545734 0.61870398 19 | 1.179 -56.89194091 0.60267088 20 | 1.209 -53.92842448 0.58663777 21 | 1.239 -50.96490805 0.57060467 22 | 1.269 -48.26400312 0.55561695 23 | 1.299 -46.17979427 0.54308415 24 | 1.329 -44.09558542 0.53055134 25 | 1.359 -42.01137657 0.51801853 26 | 1.389 -39.92716772 0.50548572 27 | 1.419 -38.15571996 0.49376956 28 | 1.449 -36.39796611 0.48208915 29 | 1.479 -34.64021226 0.47040875 30 | 1.509 -32.88245842 0.45872834 31 | 1.538 -31.63109224 0.42667799 32 | 1.568 -30.40562530 0.39358583 33 | 1.598 -29.18015836 0.36049366 34 | 1.628 -27.95469142 0.32740149 35 | 1.658 -26.85681781 0.32557416 36 | 1.688 -25.84026716 0.34367380 37 | 1.718 -24.82371651 0.36177343 38 | 1.748 -23.80716586 0.37987307 39 | 1.778 -22.90566719 0.39627520 40 | 1.808 -22.07959054 0.41156452 41 | 1.838 -21.25351389 0.42685385 42 | 1.868 -20.42743724 0.44214317 43 | 1.898 -19.70131916 0.45517226 44 | 1.928 -19.04258932 0.46667759 45 | 1.958 -18.38385948 0.47818291 46 | 1.988 -17.72512964 0.48968823 47 | 2.018 -17.08469219 0.49103589 48 | 2.048 -16.49721858 0.46297301 49 | 2.078 -15.90974498 0.43491013 50 | 2.108 -15.32227137 0.40684725 51 | 2.137 -14.76498445 0.38836413 52 | 2.167 -14.29825914 0.39862077 53 | 2.197 -13.83153382 0.40887742 54 | 2.227 -13.36480850 0.41913406 55 | 2.257 -12.89808318 0.42939070 56 | 2.287 -12.44513829 0.40809530 57 | 2.317 -11.99356637 0.38365634 58 | 2.347 -11.54199444 0.35921737 59 | 2.377 -11.09042252 0.33477840 60 | 2.407 -10.71251904 0.32719575 61 | 2.437 -10.34255795 0.32143042 62 | 2.467 -9.97259686 0.31566510 63 | 2.497 -9.60263577 0.30989977 64 | 2.527 -9.28848287 0.30467629 65 | 2.557 -8.98080976 0.29951573 66 | 2.587 -8.67313665 0.29435516 67 | 2.617 -8.36546354 0.28919459 68 | 2.647 -8.06640400 0.27659586 69 | 2.677 -7.77424070 0.25804195 70 | 2.707 -7.48207741 0.23948803 71 | 2.736 -7.18991412 0.22093412 72 | 2.766 -6.93187431 0.21058813 73 | 2.796 -6.70190521 0.20699416 74 | 2.826 -6.47193611 0.20340019 75 | 2.856 -6.24196702 0.19980622 76 | 2.886 -6.01379981 0.19854581 77 | 2.916 -5.79249144 0.20616803 78 | 2.946 -5.57118307 0.21379025 79 | 2.976 -5.34987471 0.22141247 80 | 3.006 -5.12836496 0.22646985 81 | 3.036 -4.90605644 0.22135343 82 | 3.066 -4.68374791 0.21623701 83 | 3.096 -4.46143939 0.21112059 84 | 3.126 -4.24606094 0.20607629 85 | 3.156 -4.05935810 0.20133041 86 | 3.186 -3.87265525 0.19658453 87 | 3.216 -3.68595241 0.19183865 88 | 3.246 -3.49924957 0.18709277 89 | 3.276 -3.31613126 0.19611533 90 | 3.306 -3.13362564 0.20749125 91 | 3.335 -2.95112002 0.21886717 92 | 3.365 -2.76861440 0.23024309 93 | 3.395 -2.59684445 0.24209564 94 | 3.425 -2.42700902 0.25403408 95 | 3.455 -2.25717358 0.26597252 96 | 3.485 -2.08733815 0.27791096 97 | 3.515 -1.91263188 0.28834774 98 | 3.545 -1.73318390 0.29732267 99 | 3.575 -1.55373591 0.30629760 100 | 3.605 -1.37428792 0.31527253 101 | 3.635 -1.20641727 0.31503044 102 | 3.665 -1.05012395 0.30557132 103 | 3.695 -0.89383064 0.29611220 104 | 3.725 -0.73753733 0.28665308 105 | 3.755 -0.52642528 0.32199689 106 | 3.785 -0.25900177 0.40336363 107 | 3.815 0.00842174 0.48473037 108 | 3.845 0.27584525 0.56609710 109 | 3.875 0.51748911 0.66389262 110 | 3.905 0.61607559 0.85285534 111 | 3.934 0.71466207 1.04181806 112 | 3.964 0.81324855 1.23078079 113 | 3.994 0.89639678 1.43222521 114 | 4.024 0.88922267 1.70669454 115 | 4.054 0.88204855 1.98116387 116 | 4.084 0.87487444 2.25563319 117 | 4.114 0.86770033 2.53010252 118 | 4.144 0.80959487 2.71298074 119 | 4.174 0.73918180 2.87372589 120 | 4.204 0.66876873 3.03447103 121 | 4.234 0.59835566 3.19521618 122 | 4.264 0.54555350 3.29473473 123 | 4.294 0.49719090 3.37881856 124 | 4.324 0.44882831 3.46290238 125 | 4.354 0.40046571 3.54698620 126 | 4.384 0.35868188 3.59895239 127 | 4.414 0.31862636 3.64248095 128 | 4.444 0.27857084 3.68600951 129 | 4.474 0.23851532 3.72953806 130 | 4.504 0.19462622 3.75717110 131 | 4.533 0.14607716 3.76548216 132 | 4.563 0.09752811 3.77379321 133 | 4.593 0.04897905 3.78210427 134 | 4.623 0.00938751 3.78243625 135 | 4.653 -0.01901526 3.77280161 136 | 4.683 -0.04741802 3.76316698 137 | 4.713 -0.07582079 3.75353234 138 | 4.743 -0.10309357 3.74387391 139 | 4.773 -0.12063413 3.73401052 140 | 4.803 -0.13817470 3.72414714 141 | 4.833 -0.15571527 3.71428375 142 | 4.863 -0.17256102 3.70377236 143 | 4.893 -0.18296166 3.68725004 144 | 4.923 -0.19336230 3.67072771 145 | 4.953 -0.20376294 3.65420539 146 | 4.983 -0.21313079 3.63800318 147 | 5.013 -0.21213159 3.62501421 148 | 5.043 -0.21113239 3.61202524 149 | 5.073 -0.21013319 3.59903626 150 | 5.103 -0.20913399 3.58604729 151 | 5.132 -0.21289082 3.56721124 152 | 5.162 -0.21823308 3.54642604 153 | 5.192 -0.22357534 3.52564085 154 | 5.222 -0.22891760 3.50485566 155 | 5.252 -0.22562445 3.49513608 156 | 5.282 -0.21934883 3.48923830 157 | 5.312 -0.21307322 3.48334052 158 | 5.342 -0.20679760 3.47744274 159 | 5.372 -0.20462561 3.46517223 160 | 5.402 -0.20854078 3.44344865 161 | 5.432 -0.21245595 3.42172506 162 | 5.462 -0.21637112 3.40000147 163 | 5.492 -0.22068567 3.38372929 164 | 5.522 -0.22560941 3.37577267 165 | 5.552 -0.23053316 3.36781605 166 | 5.582 -0.23545690 3.35985944 167 | 5.612 -0.24366825 3.34646618 168 | 5.642 -0.25703776 3.32454298 169 | 5.672 -0.27040727 3.30261978 170 | 5.702 -0.28377678 3.28069658 171 | 5.731 -0.29672811 3.25887053 172 | 5.761 -0.30150241 3.23894399 173 | 5.791 -0.30627670 3.21901745 174 | 5.821 -0.31105100 3.19909092 175 | 5.851 -0.31575374 3.17919156 176 | 5.881 -0.31882225 3.15991307 177 | 5.911 -0.32189076 3.14063457 178 | 5.941 -0.32495926 3.12135608 179 | 5.971 -0.32802777 3.10207758 180 | 6.001 -0.33387548 3.07609902 181 | 6.031 -0.34090666 3.04726733 182 | 6.061 -0.34793785 3.01843564 183 | 6.091 -0.35496903 2.98960395 184 | 6.121 -0.35261070 2.96879583 185 | 6.151 -0.34612480 2.95151482 186 | 6.181 -0.33963889 2.93423381 187 | 6.211 -0.33315299 2.91695281 188 | 6.241 -0.32946417 2.89565421 189 | 6.271 -0.32704426 2.87253304 190 | 6.301 -0.32462434 2.84941188 191 | 6.330 -0.32220442 2.82629071 192 | 6.360 -0.31951533 2.80246219 193 | 6.390 -0.31632042 2.77730440 194 | 6.420 -0.31312551 2.75214660 195 | 6.450 -0.30993061 2.72698881 196 | 6.480 -0.30909673 2.70124092 197 | 6.510 -0.31283354 2.67435068 198 | 6.540 -0.31657034 2.64746045 199 | 6.570 -0.32030715 2.62057022 200 | 6.600 -0.32404383 2.59367984 --------------------------------------------------------------------------------