## 3 LED Model Parameter Extraction Methods
### The Nelder-Mead Method  
The Nelder-Mead method is a gradient-free, simplex-based direct search method. Let us use the following notations:  
* Let N denote the number of parameters to be extracted;
* let \(f(x)\) denote the cost function to be minimized during the search for the best fitting parameters in the N-dimensional parameter space, and;
* let \(x\) denote a point in the N-dimensional parameter space.  
During the search for the global minimum of the cost function \(f(x)\), an initial guess of \(\text{N}+1\) point (vectors) was made, each being a candidate for the final set of parameters, where \(f(x)\) reaches its minimum. This collection of \(\text{N}+1\) parameter sets is referred to as a simplex: \(S=x_{0},x_{1},x_{2}\ldots x_{\text{N}}\in\mathbb{R}^{\text{N}}\). The evaluation and modification of \(S\)--as the optimization process involves the following steps:  
1. Identify the data points for which the \(f(x)\) cost function provides the largest, the second largest, and the smallest values. Denote these points as follows: \((x_{max}|\underset{i\
eq max}{\max}f(x_{i}))\), \((x_{sec}|\underset{i\
eq max}{\max}f(x_{i}))\), and \((x_{min}|\underset{i\
eq max,sc}{\min}f(x_{i}))\).
2. Calculate the coordinates of the centroid of the N best vectors: \(x_{e}=\frac{1}{\sum_{i\
eq max}x_{i}}\).
3. Replace \(x_{max}\) with a new point in the vertex by creating a line between \(x_{e}\) and \(x_{max}\), and try out different points on this line. The points are called the reflection, the expansion, and the contraction points of \(x_{max}\) with respect to \(x_{e}\), calculated as follows: 1. Reflection: \(x_{r}=x_{c}+\alpha\cdot(x_{c}-x_{max})\). The reflection point replaces the maximum point if \(f(x_{min})\leq f(x_{r})<f(x_{sec})\). 2. Expansion: If \(f(x_{r})<f(x_{min})\), there is a chance to find a better point if we move elsewhere on the line, so \(x_{e}=x_{c}+\gamma(x_{max}-x_{c})\). If \(x_{e}\) is better than \(x_{r}\), the maximum point is replaced with that value; otherwise, we keep the reflection point. 3. Contraction: If \(f(x_{max})>f(x_{r})>f(x_{sec})\), the contraction point will be \(x_{co}=x_{c}+\beta(x_{r}-x_{c})\); otherwise, if \(f(x_{r})>f(x_{max})\), then \(x_{co}=x_{c}+\beta(x_{max}-x_{c})\). If \(f(x_{co})<f(x_{max})\), the condition holds. 4. If no replacement point is found, shuffle all the vectors except the best, \(x_{i}=x_{min}+\sigma(x_{i}-x_{min})\). The Nelder-Mead method can be terminated under one of these conditions:  
1. A lack of improvement after numerous iterations.
2. If the minimum of \(f(x)\) is close enough to 0.
3. The number of function evaluations or iteration steps reaches its preset maximum number.  
The function to be minimized is the following for the electrical part:  
\[E_{e}=\sum_{i}\frac{\left(V_{calc_{i}}-V_{meas_{i}}\right)^{2}}{V_{meas_{i}}^ {2}} \tag{10}\]where the summation is applied to every data point of the measured I-V characteristics, with \(V_{meas_{i}}\) denoting the \(i\)-th measured forward voltage and \(V_{calc_{i}}\) denoting the \(i\)-th forward voltage value calculated for the same operating point, where \(V_{meas_{i}}\) is measured. The division by the measured voltage square is not necessary, but it is needed to avoid low voltage points, especially for the optical part of the model, for which the cost function to be minimized is as follows (with notations similar to the ones applied in Equation (10), with \(\Phi_{e}\) representing radiant flux values):  
\[E_{r}=\sum_{i}\frac{\left(\Phi_{e,calc_{i}}-\Phi_{e,meas_{i}}\right)^{2}}{\Phi _{e,meas_{i}}} \tag{11}\]  
Unfortunately, the original Nelder-Mead algorithm fails for the cost functions described in Equations (10) and (11), i.e., it is stuck at a local minimum. With a few modifications, however, we succeeded to overcome this problem.