convert python code to MATLAB

6 views (last 30 days)
Yasyfa Rifiani Putri
Yasyfa Rifiani Putri on 6 Nov 2021
Edited: Chris on 7 Nov 2021
Hi, everyone! I need a help to convert python code to matlab about mie scattering in homogenous sphere, below is my python code. I add 'z' variable to get the value of scattering.
import PyMieScatt as ps
mie = ps.MieQ(1.525+0.0011j,450,300,asDict=True) %index refractive, wavelength, diameter of particle
z = mie['Qsca']
Cris LaPierre
Cris LaPierre on 7 Nov 2021
Admitting that I know nothing about this topic, a keyword search indicates this file exchange submission might be of interest.

Sign in to comment.

Answers (1)

Chris on 7 Nov 2021
Edited: Chris on 7 Nov 2021
With in your Matlab path and pyenv set up correctly, do:
mie = struct(py.Mie.MieQ(1.525+0.0011j,450,300,pyargs('asDict',true)))
z = mie.Qsca

Community Treasure Hunt

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

Start Hunting!

Translated by