__Auxiliary section__

In this section, auxiliary and complementary code is presented that may prove useful in various rough surface scattering simulations. The code includes algorithms for calculating and plotting amplitude and intensity reflection coefficients of various media [1], methods for converting between optical and dielectric constants and routines for computing distributions of surface normals och inclination angles (the angle between the local surface normal and a reference axis, usually the global surface normal).

__Matlab code__

## Reflection coefficients

[rs,rp] = amprc (n,k,theta)_{s}and r

_{p}of light incident from air with a polar angle of incidence theta on an optical medium with complex refractive index n+ik using Fresnel's equations.

INPUT: n-refractive index, k-extinction coefficient, theta-angle of incidence

OUTPUT: rs-amplitude reflection coefficient for s-polarized component, rp-amplitude reflection coefficient for p-polarized component

[Rs,Rp,R] = intrc (n1,n2,k2,theta)

INPUT: n1-refractive index of first medium, n2-refractive index of second medium, k2-extinction coefficient of second medium, theta-angle of incidence

OUTPUT: Rs-(intensity) reflection coefficient for s-polarized component, Rp-(intensity) reflection coefficient for p-polarized component, R-reflectivity for circular (or unpolarized) polarization

fresnelplot (n1,n2,k2,plotopt)

INPUT: n1-refractive index of first medium, n2-refractive index of second medium, k2-extinction coefficient of second medium, plotopt-plotting option (type 'R' for plotting reflectivity, 'A' for absorptivity or 'RA' for both)

OUTPUT: plot(s) of reflectivity and/or absorptivity as a function of angle of incidence

*Figure 1*: MATLAB plots of the reflectivities and absorptivities as a function of angle of incidence using fresnelplot (in this particular case for copper at a wavelength of 1.06mm).

## Optical and dielectric constants

[e1,e2] = oc2dc (n,k)INPUT: n-refractive index, k-extinction coefficient

OUTPUT: e1-real part of the dielectric constant, e2-imaginary part of the dielectric constant

[n,k] = dc2oc (e1,e2)

INPUT: e1-real part of the dielectric constant, e2-imaginary part of the dielectric constant

OUTPUT: n-refractive index, k-extinction coefficient

## Surface normals and inclination angles

[nx,ny] = normals1D (f,x)INPUT: f-surface heights, x-surface points

OUTPUT: nx-x components or surface normals, ny-y components or surface normals

[nx,ny,nz] = normals2D (f,x,y)

INPUT: f-surface heights, x-surface points, y-surface points

OUTPUT: nx-x components or surface normals, ny-y components or surface normals, nz-z components or surface normals

iaplot1D (f,x,plotopt) - (requires normals1D)

INPUT: f-surface heights, x-surface points, plotopt-plotting option (type 'plot' for plotting the continuous distribution or 'hist' for plotting a histogram of the discrete distribution)

OUTPUT: plot of the distribution of inclination angles

iaplot2D (f,x,y,plotopt) - (requires normals2D)

INPUT: f-surface heights, x-surface points, y-surface points, plotopt-plotting option (type 'plot' for plotting the continuous distribution or 'hist' for plotting a histogram of the discrete distribution)

OUTPUT: plot of the distribution of inclination angles

*Figure 2*: MATLAB plots of the inclination angle distributions for 1D surface profiles using iaplot1D (left) and for 2D surfaces using iaplot2D (right), both surfaces with the same rms height and correlation length illustrating the difference in 2D and 3D scattering.

**References:**

[1] Modest, M.: "Radiative Heat Transfer", Elsevier Science, 2nd Edition (2003).