1 Introduction

Gradient index (GRIN) optics is a new independent subject, which studies the optical performance of GRIN elements, the production of GRIN materials, and the design and analysis of GRIN optical systems [1,2,3,4,5]. The origin of this subject can be traced back to the 1850s; however, research on GRIN optics has been primarily limited to theoretical studies due to the limitations of the fabrication technologies. Until the 1970s, Japanese scientists took the lead in manufacturing the glass radial gradient index lens (self-focusing lens), which enhanced the practical applications of GRIN optics. As a result, GRIN materials entered a rapid development stage, and a variety of manufacturing processes emerged, such as ion exchange [6], chemical vapor deposition [7], neutron irradiation [8], diffusion-assisted coextrusion process [9], and variations of polymer-based processes [10]. In addition, since GRIN materials can widely be used in various fields, the study of GRIN optics is of great significance.

It is essential to understand the GRIN distribution for effective usage of GRIN materials, because the refractive index distribution determines the ray trajectory within the medium. Therefore, knowing the GRIN distribution of a medium is the first challenge to be resolved. Some studies on the measurement or estimation of the GRIN profiles have been reported in recent decades. For example, Vazquez et al. [11] developed a tomographic method to reconstruct the refractive index profiles of lenses, which are rotationally symmetrical around the optical axis, and analyzed the effects of the experimental errors on the accuracy and versatility of this method. Verma et al. [12] adopted optical coherence tomography to measure the refractive index profiles of a crystalline lens of a fisheye, and the measurement error of the refractive index was only approximately 1%. Sokolov et al. [13] studied the refractive index gradient measurement in nonuniformly thick dielectric films, and the method they developed can be used for an arbitrary shape of the index modulation over the film thickness in the limit of a small gradient. Hsieh et al. [14] used heterodyne interferometry to measure the refractive index distribution of a GRIN lens, and this method has the merits of both common-path interferometry and heterodyne interferometry. Cai et al. [15] employed a polynomial to calculate the gradient refractive index profiles of GRIN ball lenses and used a shearing interferometer to measure the gradient refractive index profiles of these lenses rapidly, automatically, and nondestructively. Teichman et al. [16] used the relationship between the refractive index distribution and ray paths to estimate the refractive index distribution, in which the laser beam deflection, displacement, and mode conversion on passing through the media were adopted as known information. Tian et al. [17] gave a complete data-processing procedure for quantitative reconstruction of the refractive index fields from limited multidirectional interferometric data, and this method was proved via experiments to be accurate and reliable. Nihei et al. [18] designed a method in which the transverse ray-tracing method is adopted to indirectly determine the refractive index distribution of a graded-index polymer optical fiber by comparing the displacement of the transverse ray projected on the screen with the actual measurement. Henke et al. [19] developed a rapid and simple technique for the determination of the refractive index of ultra-thin organic films on planar transparent substrates using forward light scattering. Lin et al. [20] developed a nondestructive measurement technique in which they used boundary value measurements of positions and slopes for a series of probe beams and adopted a bootstrap algorithm to recover the one-dimensional refractive index distribution. Subsequently, they [21, 22] extended the method for the reconstruction of a two-dimensional inhomogeneous refractive index field based on ray deflection measurements.

These previous studies indicate that the measurement techniques are mainly based on deflection measurements, interferometry methods and optical coherence imaging. The methods utilizing beam displacements or deflections are typically based on simplifying geometric assumptions [21, 23] that become invalid when a significant amount of refraction occurs inside the sample. Moreover, interferometric methods based on fringe patterns are ambiguous without prior knowledge [21, 24]; besides, resolving the fringes can be difficult when the propagation distances within the medium are substantial. Optical coherence imaging is a high-resolution imaging technique for layered GRIN profiles [21, 25], but its disadvantage is that scattering elements are required (such as the discontinuities of the refractive index) due to the principle of this method. Wei et al. [26] determined the GRIN profiles of the slab medium based on radiative transfer, but the GRIN could not be inversed if the absorption coefficient and scattering coefficient of medium are unknown in advance. This disadvantage seriously limit its application. In other words, there are insufficient studies on the estimation of the GRIN profiles resulting in an urgent need for developing more measurement methods and inverse techniques. In recent years, the inverse technique based on swarm intelligent algorithms has been popular for parameter identification. Stochastic particle swarm optimization (SPSO), as an excellent intelligent algorithm, has been widely employed to solve inverse problems. For example, Sun et al. [27] used the SPSO algorithm to estimate the soot volume fraction and temperature in flames from multi-wavelength emissions. Yuan et al. [28] adopted the SPSO algorithm to solve the inverse problem for the estimation of the particle size distributions of atmospheric aerosols. Qi et al. [29] first employed the SPSO algorithm to solve the inverse radiation problems and the successfully obtained the source term, extinction coefficient, scattering coefficient, and absorption coefficient. Ruan et al. [30] utilized the SPSO algorithm to determine the optical properties and thickness of optical thin films. Ren et al. [31] used SOPO algorithm to retrieve simultaneously temperature-dependent absorption coefficient and thermal conductivity of participating medium. These studies show that the SPSO algorithm is a good global optimization solver in inverse estimating parameters with prior knowledge and can be employed to solve estimation of parameters with corresponding prior knowledge. However, previous SPSO studies did not estimate GRIN profiles based on geometrical optics.

This paper presents the first application of the SPSO algorithm for determining the GRIN profiles based on optical measurements. The motivation of the present work is to establish a retrieval model of the GRIN of the slab medium, and obtain the accurate GRIN profiles with or without known functional forms. In additions, the effects of the measurement errors on retrieval accuracy of GRIN are analyzed thoroughly. The remainders of this work are as follows: the direct model of laser beam propagation in GRIN medium is given in Sect. 2; the SPSO algorithm is introduced in Sect. 3; the retrieval results and analysis are presented in the Sect. 4; and the main conclusions are given in Sect. 5.

2 Ray tracing model

Due to the heterogeneity of composition, density and temperature distribution of semitransparent media as well as the Kerr effect and electrostrictive effect, the refractive index of a medium may be a function of the spatial position [32]. In GRIN medium, the ray goes along a curved path determined by the Fermat principle, and even the total reflection occurs inside the medium as shown in Fig. 1. Theoretically, the curved ray path can be described by the ray equation [33, 34]:

$$\frac{{\text{d}}}{{{\text{d}}s}}\left[ {n\left( {\varvec{R}} \right)\frac{{{\text{d}}{\varvec{R}}}}{{{\text{d}}s}}} \right] = \nabla n\left( {\varvec{R}} \right),$$
(1)

where \({\varvec{R}} \equiv \left( {x,y,z} \right)\) is the position vector of a point on a ray; s is the length of ray measured from a fixed point on it; and n(R) is the refractive index. However, it is difficult to solve the ray equation analytically in most cases, especially for the multi-dimensional complex medium problems. To meet the needs of practical applications, a numerical method, for example, the Runge–Kutta method can be used to calculate the ray trajectories [33, 34]. By introducing a new variable t via

$${\text{d}}s{ = }n\left( {\varvec{R}} \right){\text{d}}t.$$
(2)
Fig. 1
figure 1

Schematic diagram of light transmission in media with GRIN

The ray equation can be transformed into a second-order linear differential equation:

$$\frac{{{\text{d}}^{2} {\varvec{R}}}}{{{\text{d}}t^{2} }} = n\left( {\varvec{R}} \right)\nabla n\left( {\varvec{R}} \right) = \frac{1}{2}\nabla \left( {n\left( {\varvec{R}} \right)} \right)^{2} = {\varvec{D}}\left( {\varvec{R}} \right),$$
(3)

where a vector D characterizing the GRIN medium is introduced.

To solve this equation numerically for R(t) by the Runge–Kutta method it is converted into a system of two first order differential equations:

$$\left\{ \begin{gathered} \frac{{{\text{d}}{\varvec{R}}}}{{{\text{d}}t}} = T\left( {{\varvec{R}},t} \right) \hfill \\ \frac{{{\text{d}}{\varvec{T}}}}{{{\text{d}}t}} = D\left( {\varvec{R}} \right) \hfill \\ \end{gathered} \right.,$$
(4)

by introducing a vector function T. Here we use third-order Runge–Kutta formulas expressed as [33, 34]

$$\left\{ \begin{gathered} {\varvec{k}}_{1} = \Delta t{\varvec{D}}\left( {{\varvec{R}}_{n} } \right) \hfill \\ {\varvec{k}}_{2} = \Delta t{\varvec{D}}\left( {{\varvec{R}}_{n} + \left( {{{\Delta t} \mathord{\left/ {\vphantom {{\Delta t} 2}} \right. \kern-\nulldelimiterspace} 2}} \right){\varvec{T}}_{n} + \left( {{{\Delta t} \mathord{\left/ {\vphantom {{\Delta t} 8}} \right. \kern-\nulldelimiterspace} 8}} \right){\varvec{k}}_{1} } \right) \hfill \\ {\varvec{k}}_{3} = \Delta t{\varvec{D}}\left( {{\varvec{R}}_{n} + \Delta t{\varvec{T}}_{n} + \left( {{{\Delta t} \mathord{\left/ {\vphantom {{\Delta t} 2}} \right. \kern-\nulldelimiterspace} 2}} \right){\varvec{k}}_{2} } \right) \hfill \\ \end{gathered} \right.,$$
(5)
$$\left\{ \begin{gathered} {\varvec{R}}_{n + 1} = {\varvec{R}}_{n} + \left( {{{\Delta t} \mathord{\left/ {\vphantom {{\Delta t} 6}} \right. \kern-\nulldelimiterspace} 6}} \right)\left( {6{\varvec{T}}_{n} + {\varvec{k}}_{1} + 2{\varvec{k}}_{2} } \right) \hfill \\ {\varvec{T}}_{n + 1} = {\varvec{T}}_{n} + \left( {{1 \mathord{\left/ {\vphantom {1 6}} \right. \kern-\nulldelimiterspace} 6}} \right)\left( {{\varvec{k}}_{1} + 4{\varvec{k}}_{2} + {\varvec{k}}_{3} } \right) \hfill \\ \end{gathered} \right.,$$
(6)

to calculate R(t) and T(t), where \(\Delta t\) is the step size (the increment in t) and the subscript n is the iteration index. Reasonable step size \(\Delta t\) is important to guarantee accuracy of numerical solution. Therefore, the selection of step size \(\Delta t\) should be done first. The GRIN of a slab medium with thickness L = 1 length unit is set as n(z) = 1.2 + 0.6z. Figure 2 gives the curved ray trajectories which originate from left wall with different initial directions and end at the left or right wall. It can be seen that the results with step sizes \(\Delta t = 0.1\), \(\Delta t = 0.01\), \(\Delta t = 0.001\) and \(\Delta t = 0.0001\) are very close, which indicates that relatively large step size can be selected. As a compromise between the accuracy and efficiency, the step size \(\Delta t = 0.001\) was selected for this study.

Fig. 2
figure 2

Ray trajectories with different step sizes

3 Inverse scheme

3.1 Inverse model

The optical measurement scheme for the GRIN retrieval by the inverse model is shown in Fig. 3. A family of interrogating beams generated by a laser device transit a slab medium sample with a GRIN. The exit positions of the laser beams are recorded as measurement data to determine the GRIN, and the corresponding objective function can be defined as

$$F_{{{\text{obj}}}} = \sum\limits_{i = 1}^{N} {\left( {{{x_{i}^{{{\text{pre}}}} } \mathord{\left/ {\vphantom {{x_{i}^{{{\text{pre}}}} } {x_{i}^{{{\text{mea}}}} }}} \right. \kern-\nulldelimiterspace} {x_{i}^{{{\text{mea}}}} }} - 1} \right)^{2} } ,$$
(7)

where \(x_{i}^{{{\text{pre}}}}\) and \(x_{i}^{{{\text{mea}}}}\) are the predicted and measured exit positions, respectively; and N is the number of the laser beams.

Fig. 3
figure 3

Schematic illustration of laser beam position measurement for GRIN profile retrieval

To evaluate the reliability and the performance of the inverse model, a detailed sensitivity analysis is performed to characterize the relation between the known information and retrieval parameters. The sensitivity coefficient is the first derivative of a dependent variable with respect to an independent variable and is defined as

$$S_{{m_{i} }} \left( {x^{{m_{i} }} } \right) = \frac{{\partial x^{{m_{i} }} }}{{\partial m_{i} }}\left| {_{{m_{i} = m_{0} }} } \right. = \frac{{x^{{m_{i} }} \left( {m_{0} + m_{0} \Delta } \right) - x^{{m_{i} }} \left( {m_{0} - m_{0} \Delta } \right)}}{{2m_{0} \Delta }},$$
(8)

where mi denotes the independent variables which stands for the coefficients of the GRIN; ∆ represents a tiny change that is set to 0.5%; and \(x^{{m_{i} }}\) denotes the exit position of the laser beam at the right boundary. If the sensitivity coefficients are either small or correlated with one another, inverse problems can be highly sensitive to measurement errors. In other words, the retrieval parameters are then difficult to obtain from the measurement data.

Considering the linear GRIN n(z) = a + bz and sinusoidal GRIN n(z) = a + bsin(πz) as examples (a = 1.2 and b = 0.6 are selected here), the sensitivity coefficients of the measurement data are shown in Fig. 4. It can be observed that the sensitivity coefficients of the known information for the retrieval parameters a and b are relatively large. The absolute values of the sensitivity coefficients increase with the incident angle of the laser beam, and the sensitivity coefficients to parameter a is not correlated with those to parameter b. These observations indicate that the developed inverse model is reasonable and the GRIN profiles can be accurately inversed in theory.

Fig. 4
figure 4

Sensitivity analysis of measurement data on retrieved parameters

3.2 SPSO algorithm

The SPSO algorithm is used to solve the above mentioned inverse problem. This algorithm was proposed by Cui and Zeng [35] based on the standard PSO algorithm. The basic principle of this algorithm is that the parameters of the particle at the best global position will be fixed and other particles will be shifted to the weighted center between their local best position and the global position. Compared with the standard PSO algorithm, the SPSO algorithm can solve the problem of premature convergence more effectively [29]. In the SPSO algorithm, the evolution equations for velocity Vi and position Xi (i.e., the retrieval parameters) of the ith particle in the (t + 1)th generation are expressed as

$${\mathbf{V}}_{i} \left( {t + 1} \right) = c_{1} \cdot R_{1} \cdot \left[ {{\mathbf{P}}_{i} \left( t \right) - {\mathbf{X}}_{i} \left( t \right)} \right] + c_{2} \cdot R_{2} \cdot \left[ {{\mathbf{P}}_{{\text{g}}} \left( t \right) - {\mathbf{X}}_{i} \left( t \right)} \right],$$
(9)
$${\mathbf{X}}_{i} \left( {t + 1} \right) = {\mathbf{X}}_{i} \left( t \right) + {\mathbf{V}}_{i} \left( {t + 1} \right),$$
(10)

where i = 1, 2,…, M; c1 and c2 are the acceleration coefficients; R1 and R2 are the uniformly distributed random numbers in [0, 1]; Vi(t + 1) is the speed of the ith particle at the (t + 1)th generation; Xi(t) is the position of the ith particle at the tth generation; Xi(t + 1) is the position of the ith particle at the (t + 1)th generation; Pi(t) is the local best position of the ith particle at the tth generation; and Pg(t) is the global best position of the tth generation.

In addition, the SPSO algorithm decreases the global search capability but increases the local search capability. Pg can be maintained as the best position historically to improve the global search capability of the SPSO algorithm, and the position Xj(t + 1) of the jth particle is generated randomly in the search space. Moreover, the other particle \(i\left( {i \ne j} \right)\) at the position Xi(t + 1) evolves according to Eqs. (9) and (10). The following correction procedure can be obtained:

$${\mathbf{P}}_{j} = {\mathbf{X}}_{j} \left( {t + 1} \right),$$
(11a)
$${\mathbf{P}}_{i} = \left\{ {\begin{array}{*{20}c} {\begin{array}{*{20}c} {{\mathbf{P}}_{i} ,} & {F\left( {{\mathbf{P}}_{i} } \right) < F\left[ {{\mathbf{X}}_{i} \left( {t + 1} \right)} \right]} \\ \end{array} } \\ {\begin{array}{*{20}c} {{\mathbf{X}}_{i} \left( {t + 1} \right),} & {F\left( {{\mathbf{P}}_{i} } \right) \ge F\left[ {{\mathbf{X}}_{i} \left( {t + 1} \right)} \right]} \\ \end{array} } \\ \end{array} } \right.,$$
(11b)
$${\mathbf{P^{\prime}}}_{{\text{g}}} = \arg \min \left\{ {F\left( {{\mathbf{P}}_{i} } \right)|i = 1, \ldots ,M} \right\},$$
(11c)
$${\mathbf{P}}_{{\text{g}}} = \arg \min \left\{ {F\left( {{\mathbf{P^{\prime}}}_{{\text{g}}} } \right),F\left( {{\mathbf{P}}_{{\text{g}}} } \right)} \right\},$$
(11d)

where F is the fitness function; and ‘arg min’ is an operator that returns the argument at which the function is the smallest. This procedure can strengthen the global search ability and the detailed behavior of SPSO has been well documented and presented in Ref. [29] and not repeated here.

The initial values have important effects on accuracy and efficiency of the SPSO algorithm. Poor initial values may cause SPSO unable to obtain desired results. Therefore, the initial values must be set reasonably. Here, the initial values of the SPSO algorithm are generated in the search interval randomly. First, according to the parameters to be inversed, a search range [xmin, xmax] of the retrieval parameters is determined. Then, the position of particles X representing the retrieval parameters are generated base on a random number in range of [0, 1]:

$${\mathbf{X}}_{i} = {\text{rand}} \cdot \left( {x_{\max } - x_{\min } } \right),$$
(12)

where rand is a random number generated by computer in range of [0, 1]. At last, the same treatment is applied in all particles X. Taking linear GRIN n(z) = a + bz (a = 1.2 and b = 0.6 are selected here) as example, the search interval is set as [0, 5]. The initial values of a and b are shown in Fig. 5. It can be seen that the initial values are randomly distributed in the range [0, 5]. This treatment would make the initial positions of particles locate in the entire search interval randomly, which can improve accuracy and efficiency of SPSO algorithm.

Fig. 5
figure 5

Initial values of a and b in the SPSO algorithm

3.3 Solution of inverse problem

Simulation experiments are adopted to study the estimation problem of the GRIN profiles. Interrogating beams are launched into the GRIN medium at the starting point (z0, x0) = (0, 0) with 1° angular interval and the position of the beams reaching the opposite boundary is recorded. Some interrogating beams cannot reach the opposite boundary due to total internal reflection. The exit positions of the laser beam xi are used to construct the objective function. To get closer to the real experiment, random shifts are added to the simulated data obtained by the ray-tracing model. The following relation is used in the present inverse analysis

$$x_{i}^{{{\text{mea}}}} = x_{i}^{{{\text{exact}}}} + \sigma \varsigma ,$$
(13)

where \(\varsigma\) is a normal distribution random variable with zero mean and unit standard deviation. The standard deviations of measured spot positions at the right boundary, σ for a γ measured error at 99% confidence, are determined as

$$\sigma = \frac{{x^{{{\text{exact}}}} \times \gamma }}{2.576},$$
(14)

where 2.576 indicates that 99% of a normally distributed population falls within \(\pm \;2.576\) standard deviation of the mean.

In this work, the inverse problem of refractive index estimation is transformed into an optimization problem through objective function which couples the tracing model parameters and the SPSO variables. The variable Xi of SPSO represents the retrieval parameters (a, b, c of the GRIN refractive index equation) and Pg of SPSO is the global best position at current generation and denotes the best retrieval parameters in all retrieval parameters included in all particles. Namely, Pg = [a, b, c, …] in which the fitness function F(a, b, c, …) = \(\sum\nolimits_{i = 1}^{N} {\left( {{{x_{i}^{{{\text{pre}}}} } \mathord{\left/ {\vphantom {{x_{i}^{{{\text{pre}}}} } {x_{i}^{{{\text{mea}}}} }}} \right. \kern-\nulldelimiterspace} {x_{i}^{{{\text{mea}}}} }} - 1} \right)^{2} }\) is the minimum in all particles at current generation (note that \(x_{i}^{{{\text{pre}}}}\) and \(x_{i}^{{{\text{mea}}}}\) are the predicted and measured exit position, not the retrieval parameters a, b, c). In evolution, the new values of Pg represents the retrieval results of parameters a, b, c, … of the GRIN refractive index equation. At the end of the iteration, the values of Pg at the last generation represents the final retrieval results of a, b, c, … of the GRIN refractive index equation. The particle swarm size of the SPSO algorithm is set as \(N_{{\text{p}}} = 100\), and the iteration termination criterion is that the objective function \(F_{{{\text{obj}}}} \le 10^{ - 10}\), or that the number of iteration generations reaches Ng = 1000. The flowchart of the SPSO for estimating the GRIN profiles is shown in Fig. 6.

Fig. 6
figure 6

Flowchart of SPSO for determination of GRIN profiles

To evaluate the retrieval results, the quality function of the retrieval is defined as

$$Q = \left\{ {\frac{1}{L}\int_{0}^{L} {\left[ {Y_{{{\text{est}}}} \left( z \right) - Y_{{{\text{exact}}}} \left( z \right)} \right]^{2} {\text{d}}z} } \right\}^{1/2} ,$$
(15)

where Yest(z) and Yexact(z) are the estimated and exact values of the refractive index, respectively.

4 Results and discussion

The inverse scheme is employed to solve the estimation problem of the GRIN profiles of a slab medium sample by a series of simulation experiments. All the calculations are completed using Fortran code, and the developed program is executed on an Intel Core(TM) i5-8250U PC with a 1.60 GHz CPU and 8.0 GB RAM.

4.1 Estimation of GRIN with known expressions

In this section, the GRIN with known expressions is inversed based on the retrieval model we developed. Because the expressions of the GRIN are known in advance (this can be considered as a type of prior information in inverse problems), only the coefficients of the GRIN expression need to be retrieved. First, the effects of the measurement errors on the retrieval results of the GRIN are investigated. A linear GRIN profile n(z) = a + bz (where a = 1.2 and b = 0.6) is used to demonstrate the tolerance of the inverse scheme subject to the measurement errors. The simulation experiment is performed ten times, and the average results are adopted to reduce the randomness of the SPSO algorithm. The retrieval results are presented in Fig. 7, which shows that the measurement error has a significant effect on the retrieval accuracy. When the measurement errors are set as 0.3% and 0.5%, the quality functions of the retrieval are Q = 7.36 × 10−3 and Q = 1.14 × 10−2, respectively. By contrast, when measurement errors are set as 0.7% and 1.0%, the quality functions of the retrieval are Q = 6.71 × 10−2 and Q = 1.18 × 10−1, respectively. If a relatively high accuracy of the GRIN is required, as in precision optics, the results with measurement errors 0.7% and 1.0% cannot be accepted. Therefore, a 0.5% measurement error is selected to analyze the inverse problem of the GRIN under the following cases.

Fig. 7
figure 7

Retrieval results of linear GRIN n(z) = 1.2 + 0.6z with different measurement errors


Case 1: Determination of linear GRIN

A linear GRIN is retrieved based on the inverse model shown in Fig. 3. Two types of linear GRINs n(z) = a + bz and n(z) = abz are selected herein. The retrieval results are shown in Figs. 8 and 9. It can be observed that the retrieval results of the linear GRIN with a 0.5% measurement error are consistent with the true profiles. The quality functions of the retrieval are only Q = 1.03 × 10−2, Q = 8.68 × 10−3, and Q = 1.14 × 10−2 for n(z) = 1.2 + 0.2z, n(z) = 1.2 + 0.4z, and n(z) = 1.2 + 0.6z, respectively. The total times for ten repeated calculations are 2443.27 s, 2029.33 s, and 1782.52 s for n(z) = 1.2 + 0.2z, n(z) = 1.2 + 0.4z, and n(z) = 1.2 + 0.6z, respectively. The quality functions of the retrieval are only Q = 1.88 × 10−2, Q = 2.16 × 10−2, and Q = 1.63 × 10−2 for n(z) = 1.8 − 0.5z, n(z) = 1.8 − 0.6z, and n(z) = 1.8 − 0.7z, respectively. The total times for ten repeated calculations are 2173.93 s, 2207.27 s, and 2196.66 s for n(z) = 1.8 − 0.5z, n(z) = 1.8 − 0.6z, and n(z) = 1.8 − 0.7z, respectively. These results show that the inverse scheme we developed is accurate and effective.

Fig. 8
figure 8

Retrieval results of linear GRIN n(z) = a + bz

Fig. 9
figure 9

Retrieval results of linear GRIN n(z) = a− bz

A comparison between Figs. 8 and 9 showed that the retrieval accuracy of n(z) = a + bz is higher than that of n(z) = a− bz. This may be explained by the fact that, for the GRIN n(z) = a + bz, the laser beams transit the sample from an optically thinner medium to an optically denser medium. By contrast, the reverse process occurs for the GRIN n(z) = a− bz. The total internal reflection of the laser beam may occur when it transits from an optically denser medium to an optically thinner medium. This could prevent some of the laser beams from reaching the exit boundary. The reduction of the measurement information could reduce the retrieval accuracy of the GRIN. Thus, providing a valuable reference for the arrangement of the laser device, sample and detector in a practical experiment measurement.


Case 2: Determination of sinusoidal GRIN

The retrieval of the sinusoidal GRIN is studied in this case. Similarly, two types of sinusoidal GRINs n(z) = a + bsin(πz) and n(z) = a− bsin(πz) are selected herein. The retrieval results are presented in Figs. 10 and 11, which depict the consistency between the inversed results and true profiles, especially for estimating n(z) = a + bsin(πz). The quality functions of the retrieval are only Q = 1.39 × 10−2, Q = 1.08 × 10−2, and Q = 7.79 × 10−3 for n(z) = 1.2 + 0.5sin(πz), n(z) = 1.2 + 0.7sin(πz), and n(z) = 1.2 + 0.9sin(πz), respectively. The total times for 10 repeated calculations are 4997.19 s, 4609.56 s, and 4219.77 s for n(z) = 1.2 + 0.5sin(πz), n(z) = 1.2 + 0.7sin(πz), and n(z) = 1.2 + 0.9sin(πz), respectively. The quality functions of the retrieval are only Q = 2.49 × 10−2, Q = 2.89 × 10−2, and Q = 2.36 × 10−2 for n(z) = 2.2 − 0.6sin(πz), n(z) = 2.2 − 0.8sin(πz), and n(z) = 2.2 − 1.0sin(πz), respectively. The total times for 10 repeated calculations are 4641.77 s, 4281.27 s, and 4174.31 s for n(z) = 2.2 − 0.6sin(πz), n(z) = 2.2 − 0.8sin(πz), and n(z) = 2.2 − 1.0sin(πz), respectively. Comparison between Figs. 10 and 11 shows that the retrieval accuracy of n(z) = a + bsin(πz) is higher than that of n(z) = a− bsin(πz). This result from the fact that for the GRIN n(z) = a + bsin(πz), all laser beams can transit the medium and reach the opposite boundary; while for GRIN n(z) = a − bsin(πz), some laser beams cannot reach the opposite boundary of the medium due to total internal reflection. Thus, the retrieval accuracies of the two types of sinusoidal GRINs are different.

Fig. 10
figure 10

Retrieval results of sinusoidal GRIN n(z) = a + bsin(πz)

Fig. 11
figure 11

Retrieval results of sinusoidal GRIN n(z) = a − bsin(πz)

4.2 Estimation of GRIN without known expressions

In practice, the expression of the GRIN is usually unknown in advance. Thus, it is important to study the estimation of the GRIN without prior information on its functional forms. First, the higher order polynomials are employed to estimate the GRIN profiles based on the retrieval model, as shown in Fig. 3. Considering a linear GRIN n(z) = 1.2 + 0.6z as an example, the second-order polynomial n(z) = a + bz + cz2 and the third-order polynomial n(z) = a + bz + cz2 + dz3 are adopted. The retrieval results are illustrated in Fig. 12. It is evident that the retrieval results are significantly different from the true profile. In other words, it failed to inverse the linear GRIN n(z) = 1.2 + 0.6z based on the second-order and third-order polynomial approximations. This observation indicates that the inverse model, as shown in Fig. 3, is not suiT for estimating the GRIN without the known expressions.

Fig. 12
figure 12

Retrieval results of linear GRIN n(z) = 1.2 + 0.6z

To overcome the ill-posed and multi-solution problems of estimating a GRIN without detailed functional forms, additional measurement information is required to determine the GRIN profile. Thus, an improved inverse model, as shown in Fig. 13, is developed. Compared with the inversed model given in Fig. 3, there are two improvements in the new retrieval model: (1) Two family of laser beams are adopted to transit the sample, which could generate more measurement information; (2) The refractive index on the boundary wall is measured using a refractometer, which means that their values at both boundaries can be known in advance [36]. Based on the improvement (1), the new objective function becomes

$$F_{{{\text{obj}}}} = \sum\limits_{i = 1}^{{N_{l} }} {\left( {{{x_{i,l}^{{{\text{pre}}}} } \mathord{\left/ {\vphantom {{x_{i,l}^{{{\text{pre}}}} } {x_{i,l}^{{{\text{mea}}}} }}} \right. \kern-\nulldelimiterspace} {x_{i,l}^{{{\text{mea}}}} }} - 1} \right)^{2} } + \sum\limits_{i = 1}^{{N_{r} }} {\left( {{{x_{i,r}^{{{\text{pre}}}} } \mathord{\left/ {\vphantom {{x_{i,r}^{{{\text{pre}}}} } {x_{i,r}^{{{\text{mea}}}} }}} \right. \kern-\nulldelimiterspace} {x_{i,r}^{{{\text{mea}}}} }} - 1} \right)^{2} } ,$$
(16)

where Nl and Nr are the number of the laser beams reaching the left and right boundaries, respectively; \(x_{i,l}^{{{\text{pre}}}}\) and \(x_{i,l}^{{{\text{mea}}}}\) are the predicted and measured exit positions at the left boundary; \(x_{i,r}^{{{\text{pre}}}}\) and \(x_{i,r}^{{{\text{mea}}}}\) are the predicted and measured exit positions at the right boundary. Based on the improvement (2), the constant term a can be determined from the refractive index at the left boundary, thereby reducing the number of the retrieval parameters.

Fig. 13
figure 13

Schematic illustration of advanced laser beam position measurement for improved GRIN profile retrieval

The linear GRIN n(z) = 1.2 + 0.6z is inversed based on the improved retrieval model, and the estimated results are shown in Fig. 14. It can be observed that the retrieval results are improved significantly. When the measurement errors are set as 3% and 5%, the quality functions of the retrieval are Q = 5.28 × 10−3 and Q = 6.89 × 10−3 for the polynomial hypothesis n(z) = a + bz + cz2, respectively; and the quality functions of the retrieval are Q = 2.74 × 10−3 and Q = 1.30 × 10−2 for the polynomial hypothesis n(z) = a + bz + cz2 + dz3, respectively. When the measurement errors are set as 10% and 15%, the quality functions of the retrieval are Q = 2.98 × 10−2 and Q = 6.48 × 10−2 for the polynomial hypothesis n(z) = a + bz + cz2, respectively; and the quality functions of the retrieval are Q = 5.89 × 10−2 and Q = 9.15 × 10−2 for the polynomial hypothesis n(z) = a + bz + cz2 + dz3, respectively. This indicates that the retrieval results considering 3% and 5% of the measurement errors are accurate, whereas the retrieval results considering 10% and 15% of the measurement errors are not accepted. Compared with Sect. 4.1, it can also be noted that the improved inverse model can tolerate larger measurement errors, which is of great significance to practical experiments. Therefore, a 5% measurement error is selected to analyze the inverse problem of the GRIN based on the improved retrieval model in the following cases.

Fig. 14
figure 14

Retrieval results of linear GRIN n(z) = 1.2 + 0.6z based on improved retrieval model


Case 1: Determination of linear GRIN

The linear GRIN is retrieved based on the improved inverse model. Due to the function forms of GRIN is unknown, the second-order and third-order polynomials are adopted to determine the GRIN profiles. The retrieval results are shown in Fig. 15 from which it can be seen that the GRINs n(z) = 1.2 + 0.6z and n(z) = 1.2 + 1.0z are both estimated accurately. The quality functions of the retrieval are Q = 6.89 × 10−3 and Q = 1.25 × 10−2 for n(z) = 1.2 + 0.6z and n(z) = 1.2 + 1.0z based on polynomial hypothesis n(z) = a + bz + cz2, respectively. The total times for 10 repeated calculations are 6751.69 s and 3694.21 s for n(z) = 1.2 + 0.6z and n(z) = 1.2 + 1.0z, respectively. The quality functions of the retrieval are Q = 1.30 × 10−2 and Q = 2.58 × 10−2 for n(z) = 1.2 + 0.6z and n(z) = 1.2 + 1.0z based on the polynomial hypothesis n(z) = a + bz + cz2 + dz3, respectively. The total times for ten repeated calculations are 2992.44 s and 2249.76 s for n(z) = 1.2 + 0.6z and n(z) = 1.2 + 1.0z, respectively. It should also be noted that the retrieval accuracy of the linear GRIN based on the second-order polynomial is higher than that based on the third-order polynomial. This can be explained by the fact that the second-order polynomial is closer to the linear GRIN, and fewer retrieval parameters are present in the inverse problem.

Fig. 15
figure 15

Retrieval results of linear GRIN n(z) = a + bz based on improved retrieval model


Case 2: Determination of quadratic GRIN

The quadratic GRIN is inversed based on the third-order and fourth-order polynomials in this case. The retrieval results are given in Fig. 16, which indicates that the estimated results of the GRINs n(z) = 1.2 + 0.6z + 0.3z2 and n(z) = 1.2 + 0.8z + 0.5z2 are consistent with the true profiles. The quality functions of the retrieval are Q = 2.23 × 10−2 and Q = 3.05 × 10−2 for n(z) = 1.2 + 0.6z + 0.3z2 and n(z) = 1.2 + 0.8z + 0.5z2, respectively, based on the polynomial hypothesis n(z) = a + bz + cz2 + dz3. The total times for ten repeated calculations are 3179.09 s and 5074.99 s for n(z) = 1.2 + 0.6z + 0.3z2 and n(z) = 1.2 + 0.8z + 0.5z2, respectively. The quality functions of the retrieval are Q = 3.47 × 10−2 and Q = 1.66 × 10−2 for n(z) = 1.2 + 0.6z + 0.3z2 and n(z) = 1.2 + 0.8z + 0.5z2, respectively, based on the polynomial hypothesis n(z) = a + bz + cz2 + dz3 + ez4. The total times for 10 repeated calculations are 3459.35 s and 3193.40 s for n(z) = 1.2 + 0.6z + 0.3z2 and n(z) = 1.2 + 0.8z + 0.5z2, respectively. A comparisons of Figs. 15 and 16 reveals that the retrieval accuracy of the quadratic GRIN is slightly lower than that of the linear GRIN. This is because the former is more complex, and its estimation requires the investigation of more parameters to be inversed. Both of these increase the retrieval difficulty and reduce the retrieval accuracy of the GRIN.

Fig. 16
figure 16

Retrieval results of quadratic GRIN n(z) = a + bz + cz2 based on improved retrieval model

Case 3: Determination of sinusoidal GRIN

The estimation of the sinusoidal GRIN is studied in this case. Similarly, high-order polynomials are used for the approximation. Due to the characteristics of the sine function, the second-order, third-order and fourth-order polynomials are adopted to determine the sinusoidal GRIN. Figure 17 presents the retrieval results and portrays some deviations between the retrieval results and the true profiles, except for the estimation of n(z) = 1.2 + 0.3sin(πz) based on the polynomial hypothesis n(z) = a + bz + cz2. The quality functions of the retrieval are Q = 9.77 × 10−3 and Q = 3.99 × 10−2 for n(z) = 1.2 + 0.3sin(πz) and n(z) = 1.2 + 0.6sin(πz), respectively, based on the polynomial hypothesis n(z) = a + bz + cz2. The quality functions of the retrieval are Q = 3.63 × 10−2 and Q = 1.91 × 10−2 for n(z) = 1.2 + 0.3sin(πz) and n(z) = 1.2 + 0.6sin(πz), respectively, based on the polynomial hypothesis n(z) = a + bz + cz2 + dz3. The quality functions of the retrieval are Q = 2.78 × 10−2 and Q = 6.30 × 10−2 for n(z) = 1.2 + 0.3sin(πz) and n(z) = 1.2 + 0.6sin(πz), respectively, based on the polynomial hypothesis n(z) = a + bz + cz2 + dz3 + ez4. This is because the sine function is fundamentally different from polynomial functions. Besides, a certain deviation arises when using polynomial functions to approximate sinusoidal GRIN profiles. Moreover, the measurement noise could also cause a certain deviation in the retrieval process of the sinusoidal GRIN. Therefore, the retrieval accuracy of the sinusoidal GRIN could be relatively poor.

Fig. 17
figure 17

Retrieval results of sinusoidal GRIN n(z) = a + bsin(πz) based on improved retrieval model

5 Conclusions

Determination of GRIN profiles of slab medium based on laser beam deflection measurement is studied in this work. The SPSO method is applied to solve the inverse problem to estimate GRIN first. Several common refractive index profiles: the linear GRIN, sinusoidal GRIN, and quadratic GRIN are investigated. To determine the GRIN without the known function forms, another one inverse retrieval model is developed to supply more known information, which can not only accurately retrieve the unknown GRIN, but also improve the tolerance of the measurement error. Based on the simulation experiment results, the following conclusions can be drawn.

  1. (1)

    The SPSO algorithm is an excellent solver for determining the GRIN based on the laser beam deflection measurement.

  2. (2)

    The inverse models developed in this study are accurate and effective, especially the second one which can solve the estimation problems of the GRIN without the known function forms.

  3. (3)

    Complex GRIN profiles (i.e., a sinusoidal function form) are difficult to be inversed accurately even using high-order polynomial approximations.