Skip to main content

Dear all,

I just obtained the grid sag surface from the NSC analysis, and I would like to convert it to a freeform surface expressed by extended polynomials. I try to do the surface fitting on Matlab, but the precision is unsatisfactory. So, is there any internal method in zemax can help me to achieve the conversion? Or is there any good algorithm that improves the precision of the 2D surface fitting?

 

Thanks in advance

Daoming

Dear Daoming,

 

Would you mind sharing your code for the fit? I’m surprised you have a precision issue as I think both software use doubles (64 bits) to store floating point values. Are you saying that the fit is not good in MATLAB?

I don’t use MATLAB, but I know it, and I can probably translate it to Python for comparison.

Take care,

 

David


Hi David,

Thanks for the reply, I’m currently using the cftool from Matlab to perform a rough estimation of my surface.

The figure attached is the rough fitting performed by Matlab, and as you can see I’m using simple polynomial expansions to attempt the surface fitting. After having the values for each weighted terms, I tried to type these values into the extended polynomial representation within Zemax and here’s my real problem. 

In the extended polynomial representation in Zemax, I set the radius to infinity and konic to 0, and this should help me get rid of the base term and leaving only the polynomial terms. However, there are two variables that I have no clue how to deal with:

  1. The norm radius on the Zemax side
  2. The constant term (a0) in my Matlab

Can you let me know how to link the polynomial representation in Matlab side to the one in Zemax?

Thanks, and sorry that I wasn’t put the question clear in my previous post.

 

Daoming

 


Hi Daoming,

 

Let me first give you my answer your questions, and then, some of my thoughts on how to solve your problem.

 

1. Norm Radius

Excerpt from the Help File: The normalization radius scales the X and Y intercept coordinates of the ray so that the polynomial terms are all dimensionless and the coefficients are all in lens units.

This definition isn’t clear to me, so to illustrate this concept, I’ve created a simple file (attached to this post) containing an Extended Polynomial surface with a single term (the x term) equal to one (or z = x). The aperture definition is Entrace Pupil Diameter = 10 mm. Therefore, the Semi-Diameter of the Extended Polynomial is 5 mm. By default, the Norm Radius = 100. If we look at the Surface Sag Cross Section, it looks like this:

Extended Polynomial Sag Cross Section with Norm Radius = 100

As you can see, the sag is a linear function of the position. However, at a position of 1 mm, the sag isn’t 1 mm. In fact, at a position of 1 mm, the sag is 1 / 100 (the Norma Radius) mm and if you change the Norm Radius to 1 mm, you will obtain:

Extended Polynomial Sag Cross Section with Norm Radius = 1

I think the Norm Radius is a mean to scale the sag depending on your fit.

2. a0

In your fit, a0 is a constant term. It doesn’t depend on x or y. Think of it as an offset. You can either ignore it or use the Thickness cell to emulate it (although it won’t show in the Sag Cross-Section).

 

Finally, I can see your x scale (in the cftool) varying from 0 to 500, and y scale varying from 250 to 700. What are the units? Is it millimeter? Micrometer? This will help you determine the Norm Radius. Also, note that in your case, you are missing the x^2 term (so it should be zero in OpticStudio), and you should use 5 terms.

 

Hope this helps, take care,

 

David


Hi David,

Thank you very much for your clear explanation! It helped me a lot, especially on the explanation of norm radius! That is the best explanation I’ve ever spotted on the internet!

 

Best wishes

Daoming


Hi Daoming,


Glad I could help.

Good luck with your optical design and take care,

 

David


Have you found a way to improves the precision, and

how to deal with:

  1. The norm radius on the Zemax side;
  2. The constant term (a0) in my Matlab;

I am trying to fit free-form surfaces with matlab.

Do you still use cftool to fit them,Would it be convenient to share your ideas?


Reply