MATLAB interface to W. Wiscombe's Mie scattering Fortran program
Description
Original MIEV0 program by Dr. Warren J. Wiscombe is widely known to be one of the most well-tested codes for calculating eletromagnetic scattering from a homogeneous sphere. Current repository aims at providing modern interface to this highly efficient and a de-facto reference Mie theory implementation, so that one could easily call it from MATLAB environment - either for research, or for education purposes.
Features
All capabilities of the original MIEV0 program are retained. The following quantities are computed:
- scattering Qsca and extinction Qext efficiencies;
- asymmetry factor Gqsc;
- forward- and backscatter amplitudes (SFORW and SBACK);
- scattering amplitudes vs. scattering angle for incident polarization perpendicular S1 and parallel S2 to the plane of scattering;
- coefficients in the Legendre polynomial expansions of either the unpolarized phase function or the polarized phase matrix (PMOM);
- and some other quantities related to polarized radiative transfer and resonance hitting.
Availability
At the moment, interface library is available as binary MEX file for several platforms.
- Windows. Built with non-interleaved MATLAB MEX API. Supports MATLAB R2011a and all subsequent releases. Binary files:
- Modern Windows PC (x64 platform): mlMIEV0.mexw64.
- Legacy Windows PC (x86 platform): mlMIEV0.mexw32.
- Also, see example MATLAB script: example_scattered_intensities.m.
- Linux. Built with interleaved MATLAB MEX API. Supports MATLAB R2023b and all subsequent releases. Release files:
- Binary file (x64 platform): mlMIEV0.mexa64.
- Corresponding example script, the same as for Windows: example_scattered_intensities.m.
- MATLAB Online and, correspondingly, MATLAB Mobile. By downloading Linux binary mlMIEV0.mexa64 and uploading it to MATLAB Drive, one can call it with MATLAB Online services. Another option is to directly open this library in MATLAB Online, available through Mathworks File Exchange.
4. One can try to build for another platform, where MATLAB is available.
Usage
In order to use the library, please download the binary file appropriate for your system. In the example below, we assume that version for Windows x64 is used.
- Put
mlMIEV0.mexw64into your project folder. - Create a MATLAB script, in which input parameters will be defined, or use an existing one
example_scattered_intensities.m. - Call mlMIEV0 as you would call any MATLAB function with appropriate input and output argument list:
[Qext, Qsca, Gqsc, S1, S2, Sforw, Sback, Tforw, Tback, Spike, PMOM] = ...mlMIEV0(XX, Crefin, Perfct, Mimcut, Anyang, Numang, Xmu, Nmom, Ipolzn, Momdim, Prnt, Verbose);
Argument list fully corresponds to the original MIEV0 parameter list. One exception is the last "Verbose" argument which enables some additional output from the MATLAB-Fortran MEX interface.
Please, pay attention to the following facts:
- Expression like `complex(1.33+0.0i)` always has to be used to define refractive index, even when imaginary part is zero! This is because Fortran expects parameter of the specific type (COMPLEX*16) as an input.
- Similarly, all integers in MATLAB have to be explicitly specified as `int32`, e.g. `Momdim = int32(5)`.
If you use this code, please make a reference to the original W. Wiscombe Appl. Opt. 1980 paper, or to the original NCAR report.
GitHub repository
https://github.com/ilopushenko/miev0_matlab_interface/
References
1. Wiscombe, W. Mie Scattering Calculations - Advances in Technique And Fast, Vector-Speed Computer Codes,( Ncar Tech Note TN-140+STR, National Center For Atmospheric Research, Boulder, Colorado (1979).
2. Wiscombe, W. Improved Mie scattering algorithms," Appl. Opt. 19, 1505-1509 (1980).
3. Van De Hulst. "Light Scattering by Small Particles," Dover Press, New York (1957, 1982).
4. Bohren, C. and Huffman, D. "Absorption and Scattering of Light by Small Particles," Wiley, New York (1983).
The MEX interface mlMIEV0.mexw64 and its source code is freely distributed under MIT license.
Original MIEV0 program fully belongs to Dr. Warren J. Wiscombe, 1979, 1996.
Files
README.md
Files
(4.2 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:c90df7769a8ae1e4ea2371d3a69d8096
|
3.6 kB | Download |
|
md5:8fe82650815fd0454564c597386f08f2
|
3.1 kB | Download |
|
md5:49b8fbec5f0f1051dd086f714946eb31
|
4.3 kB | Download |
|
md5:e7ce9463818d013f98ea7423f3362409
|
94.0 kB | Download |
|
md5:729859d51794486cda12df812710d882
|
67.6 kB | Download |
|
md5:1cf1e55c5455daed6812caf176e0c421
|
10.7 kB | Download |
|
md5:df568fb0d4a455f2460f1d3183521466
|
69.3 kB | Download |
|
md5:c6bce458c7ff5c3d88aa0f33347246c4
|
70.1 kB | Download |
|
md5:7c5e3f28d94025a06c1fda1f1bddd433
|
116.7 kB | Download |
|
md5:bac58defdc2a791ded168530e91ce5e9
|
87.7 kB | Download |
|
md5:fa5db4194de4090c0357127d40e7c34a
|
14.4 kB | Download |
|
md5:3b0cfb4b6cfc916086c2ce323407a565
|
15.6 kB | Preview Download |
|
md5:92f5cf03c25eda49ba33b1b9a5a5829b
|
4.6 kB | Download |
|
md5:239f3049c3f13b126afe8457b1033549
|
159.0 kB | Preview Download |
|
md5:10f443514b7901a225f1fc2b7eeac2c4
|
140.5 kB | Preview Download |
|
md5:3a108ca0252bdaf0d11fdc7032b8c2b5
|
3.4 MB | Preview Download |
Additional details
Additional titles
- Alternative title
- MATLAB interface to W. Wiscombe's MIEV0 Fortran program
Related works
- Is documented by
- Publication: 10.1364/AO.19.001505 (DOI)
Dates
- Created
-
2025-09-06Built binaries uploaded to Zenodo
Software
- Repository URL
- https://github.com/ilopushenko/miev0_matlab_interface/
- Programming language
- Fortran, MATLAB
- Development Status
- Active