# Modelling the parameters of a function

I am trying to model my data, which is the response to a ray of light on a film screen, using the following model:

$$f(x_{out},y_{out}) = \sum_{i=1}^{3} a_i exp{\left(-\left (\frac{x_{out} - cx_i}{b_i} \right )^2 - \left (\frac{y_{out} - cy_i}{b_i} \right )^2 \right)} \tag{1}$$

Where $a_i$ is the weight/amplitude, $b_i$ is the width, $cx_i$ is the center along the $x_{out}$ axis, $cy_i$ is the center along the $y_{out}$ axis.

To include the direction dependance of the screen response in the model, I modify equation $(1)$ as: $$f(x_{out},y_{out};\hat{s}) = \sum_{i=1}^{3} a_i(\hat{s}) exp{\left(-\left (\frac{x_{out} - cx_i(\hat{s})}{b_i(\hat{s})} \right )^2 - \left (\frac{y_{out} - cy_i(\hat{s})}{b_i(\hat{s})} \right )^2 \right)} \tag{2}$$

Where $a_i(\hat{s})$ is the weight/amplitude, $b_i(\hat{s})$ is the width, $cx_i(\hat{s})$ is the center along the $x_{out}$ axis, $cy_i(\hat{s})$ is the center along the $y_{out}$ axis, unit vector $\hat{s}$ is the direction of the light ray (red arrow) incident on the film screen as shown in the image.

Here, $o$ is the center, $\alpha$ is the angle between $y_{out}$ and the projection of $\hat{s}$ on the screen, $\beta$ is the angle between $\hat{s}$ and normal to the screen.

To collect a range of data (i.e. the response/blur image in the film screen to the light ray which depends on the incident ray unit vector $\hat{s}$), I have used angles $\alpha \in [0,2\pi]$ and $\beta \in (-\pi/2,\pi/2)$ which describe the unit vector $\hat{s}$.

While the general model of the screen response, $f(x_{out},y_{out})$, remains the same for all incident rays, I want to model the parameters $a_i(\hat{s})$, $b_i(\hat{s})$, $cx_i(\hat{s})$ and $cy_i(\hat{s})$ that change with $\hat{s}$. Should I do a least squares fit on these parameters individually after fitting the general model (equation $(1)$) to each measured data set?, is there any other way to do it?.

• I suspect that if you have access to Maxima, MATLAB, Mathematica or another symbolic differentiation system you should be able to get an exact solution.... (but this is just a quick comment. :) ) – usεr11852 Apr 2 '18 at 13:14
• @usεr11852 Yes, I am using Mathematica for this purpose. Should I post the code?. – dykes Apr 2 '18 at 13:20
• Probably in the Mathematica.SE that would be helpful but I don't think it would be here. – usεr11852 Apr 2 '18 at 13:27
• Is there measurement error? – AdamO Apr 2 '18 at 21:48
• @AdamO yes, there could be measurement errors but I am looking for a decent approximation. Here is the link to the same question in Mathematica SE: link to the question. – dykes Apr 2 '18 at 23:21