Obtaining variables from a list of values depending on user input
显示 更早的评论
Hello everybody: I am writing to ask for desperate help. I want to create a function which calculates the refractive index of silicon. As I haven't been able to find any formulas for this, I have instead found a list with different values of refractive index at different wavelengths in the form of a .txt file like shown below (extract):
Wavelength(nm)-refractive index-extinction coefficient
190.7 -0.847- 2.73
198.4 -0.968- 2.89
206.6 -1.11- 3.05
207.3 -1.036- 2.928
208 -1.046- 2.944
208.7 -1.066- 2.937
209.4 -1.07- 2.963
The idea is, that the user will insert a certain wavelength, and from that wavelength, the function will calculate the refractive index by looking into the list (the text file)and probably using the closest to the value inserted by the user, assigning then the correct value to the refractive index of Silicon.
SO; to make it simple: A function that when given a certain wavelength (input by the user) will look up the corresponding refractive index in the list assigning that value to a variable I will call nSi.
Is there any chance of someone telling me how to do this? Is there maybe a simpler way? Thanks everyone very much as I am doing a PhD and it is my first time programming with Matlab and I'm learning by myself...
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!