how to make lenses in matlab?

Dear sir/madam,
I am working on optical lenses. I need to create lenses such as biconvex, biconcave, planoconvex and planoconcave for my project. How could I do this in matlab? Looking forward to hearing from you soon.
Thanking you, BSD

1 Comment

How do I find the off focus points after the fft

Sign in to comment.

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 30 Aug 2011
There is at least one tool for calculating ray-paths through optical systems on the file exchange: http://www.mathworks.co.uk/matlabcentral/fileexchange/27412-opticalbench
HTH

12 Comments

Thank for the reply. The above link has good collection of matlab files for my application. But there are no proper examples or demonstrations, for using these files.
BSD
If you look, there is 10 files with "example" in their names. Those surely should be examples of how to use the functions for this or that purpose.
what are these ".exmpl" files? Why have they been used in the example programs?
BSD
Take a look in the opt_exempel*.m files. The .exmpl files are setup-files describing optical elements, with curvature of lens surfaces, glass type, lens position, diameter and other parameters.
What are the materials you have used, which contains the mathematics, for these codes. Like the mathematics for drawing lenses, ray tracing etc... Where can I find the mathematics for these codes?
BSD
The ray tracing is simply Snell's law, calculating the angle to the surface normal at the ray-entrance/exit, refraction for the glass-type at the wavelength of the ray. The plotting is just simple geometry.
As per your guidance, I found the angle of incidence at the ray entrance, and calculated the corresponding angle of refraction on surface 1 of the lens. Now based on this angle of refraction, the ray hits the other opposite, surface 2 of the lens. I know only the angle of refraction at surface 1 of the lens, now I need to draw a line from surface 1 of the lens to surface 2 of the lens based on the angle of refraction at surface 1 of the lens. But I don't know where the line will hit on surface 2 of the lens. How can I draw a line to connect these two points?
The transmitted ray will leave surface 1 and travel to surface 2 along a straight line. You know the angle of this line (to the optical axis) from applying Snell's Law at surface 1. You also know the coordinates of one of the points on the line: the point where it was refracted at surface 1. This is enough information to calculate the equation of the straight line (using the angle to determine the gradient).
The spherical surface of the lens, surface 2, is described by the equation of a circle. You'll need to look up or calculate the radius of curvature.
By solving the equations of the ray (straight line) and the lens surface (circle) you can get the coordinates of the point of intersection between the ray and the surface. There will be two solutions, one for concave surfaces, one for convex.
After picking the right solution draw a line connecting the coordinates of transmitted ray leaving surface 1 to the coordinates of the point where the ray is incident on surface 2.
HTH.
The analysis is correct. But, the angle of the line, after refraction at surface 1 of the lens, is with respect to the normal drawn at that point of incidence on the surface 1 of the lens. It is not with respect to the optical axis.
BSD
If the lens is plano-convex and surface 1 is flat then the normal will be parellel to the optical axis. This is a special case, but it makes things slightly simpler.
If surface 1 is not flat then you need to convert the angle of refraction relative to the surface normal to an angle relative to the optical axis. The geometry required is given in, among other places, Nussbaum's "Contemporary Optics for Scientists and Engineers".
By the way, if the refraction angles are "small" then using the paraxial approximation could simplify the problem.
I have drawn the rays through the lens, it is working fine. It is also undergoing refraction. Now, after the rays come out of the surface 2 of the lens, they go to infinity. So I need to draw the rays from the surface 2 upto infinity, or my rays should appear something like it is going to infinity after refraction at surface 2. How could I do this in matlab? Looking forward to hearing from you soon.
BSD
You have drawn the lens in matlab in 3D, how is it done? I used the lens equation y=sqrt((n^2-1)*((x-f)^2))+((2)*(f)*(n-1)*(x-f)));
to draw a hyperbolic lens. where n is the refractive index of the lens, f is the focal length of the lens. The above equation was taken from "Antenna handbook, volume II, antenna theory, chapter 16, by Y.T. Lo and S.W. Lee", Please reply....

Sign in to comment.

Asked:

bsd
on 30 Aug 2011

Commented:

on 28 Mar 2019

Community Treasure Hunt

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

Start Hunting!