This question is related to the question asked on Cross Validated SE: Link to the question.

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}$$

Each ray along $\hat{s}$ would give one such equation after modelling its response on the screen. Code for equation (1):

Nfunc = 3;
GeneralModel = Sum[a[i] Exp[-( ((xout - cx[i])/b[i])^2 + ((yout - cy[i])/ b[i])^2)], {i, 1, Nfunc, 1}];       (* Equation 1 *)
Parameters = Flatten[Transpose[{Join[Array[a, Nfunc][[;; ;; 1]], Array[b, Nfunc][[;; ;; 1]], Array[cx, Nfunc][[;; ;; 1]], Array[cy, Nfunc][[;; ;; 1]]]}]];

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:

enter image description here

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}$.

Since I cannot post the real data and equations (because of its large size), I am presenting fake Equations. To generate a list of fake modeled equations from every ray I use the code below where the parameters are defined as arbitrary functions.

   (* Generating different values of α and β *)
meshgrid[beta_List, alpha_List] := {ConstantArray[beta, Length[beta]], Transpose@ConstantArray[alpha, Length[alpha]]}
{beta, alpha} = meshgrid[Range[-π/2, π/2, π/8], Range[0, 2 π, π/4]];
pts = Flatten[{beta, alpha}, {2, 3}];  (* These are the combinations of angles (β,α) over which the response data is collected *)

(* Arbitrary definitions of the paramters just to generate the equations for illustration *)
a[β_, α_][1] := -β^2 - 2 α^2 + 1;
a[β_, α_][2] := β^2 + α^2 + 1;
a[β_, α_][3] := 3 β + α - 2;
b[β_, α_][1] := β^3 - 2 α - 3;
b[β_, α_][2] := β^3 + α^3 + 2;
b[β_, α_][3] := 3 β^2 + α - 6;
cx[β_, α_][1] := β^2 - 3 α^3 + 4;
cx[β_, α_][2] := β^3 + α^2 - 3;
cx[β_, α_][3] := 5 β + 3 α - 1;
cy[β_, α_][1] := 6 β - 3 α^3 + 3;
cy[β_, α_][2] := -3 β^2 + α^4 + 5;
cy[β_, α_][3] := 5 β + 3 α^5 - 1;

(* The sample data can be generated by this model (Equation 2) *)
DirectionDependentModel[β_, α_] := Sum[a[β, α][i] Exp[-( ((xout - cx[β, α][i])/b[β, α][i])^2 + ((yout - cy[β, α][i])/b[β, α][i])^2)], {i, 1, Nfunc, 1}]; 

(* These are the sample equations, as a list, for the different combinations of the angles *)
Equations = Apply[DirectionDependentModel, pts, {1}]

How can I correctly model these parameters, i.e. $a_i(\hat{s})$, $b_i(\hat{s})$, $cx_i(\hat{s})$ and $cy_i(\hat{s})$ that change with $\hat{s}$, when I would only have a list of modelled Equations to begin with?. Can anyone provide an example?.

  • $\begingroup$ Would you point out where the generated data lives? I see functions defined. I don't see data. $\endgroup$ – JimB Apr 2 '18 at 18:34
  • $\begingroup$ @JimB yes, there are only function defined in the code. By data I meant the equations that model the response data from the film screen. $\endgroup$ – dykes Apr 2 '18 at 19:12
  • $\begingroup$ I think that is a misuse of the term "data" or at least "misdirection". What is Nfunc? Is Nfunc = 3? What are xout and yout ? Those aren't defined. $\endgroup$ – JimB Apr 2 '18 at 19:22
  • $\begingroup$ @JimB ya, I couldn't think of any other term for this. Nfunc is the number of exponential functions used as given in the upper limit of the summation operator in equation $(2)$ and it is equal to 3. xout is $x_{out}$ and yout is $y_{out}$ I.e. the $x$ any $y$ Real axis. $\endgroup$ – dykes Apr 2 '18 at 19:43
  • $\begingroup$ Sorry. I see you did define Nfunc above. Can't read very well today. $\endgroup$ – JimB Apr 2 '18 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.