I am trying to solve an optimization problem where I need to take as few data points as possible to recreate a field. I know the field will have a shape similar to a 2-d Gaussian with a known center point. However, there may be some directional imperfections in the field (one side might have a steeper slope than the other).Therefore, I've come to the conclusion that an xy scan would provide adequate information to recreate the 2d shape, however I'm having trouble determining how to do this.

I'm working in python and using a linear interpolation function which will not construct the field properly given only x and y axes. One idea I am considering is converting to a polar coordinate system to do the interpolation then converting back. Converting to this coordinate system would force the xy points to be plotted on a grid which might help the interpolation function.

It feels like this will work, but I don't know enough about the math behind different kinds of interpolation methods (or the conversion for that matter) to prove to myself that it will work. Is this the appropriate way to do the interpolation or is there another method I'm not aware of?


  • $\begingroup$ Is it correct that you have sites $(x_1,y_1), \dotsc, (x_n,y_n)$ and values $z_1,\dotsc, z_n$, and you want to find a function $f$ by interpolation such that $$ f(x_i,y_i) = z_i$$ for $i=1,\dotsc, n$? $\endgroup$ – user251257 Feb 8 '17 at 21:33
  • $\begingroup$ Not quite, I have points on the axes. So, $f(x_i, y_0)=z_i$ and $f(x_0, y_j)=z_j$ for $i=0,...,n$. I am looking for a function $f$ such that $f(x_i,y_j)=z_{ij}$. $\endgroup$ – eeScott Feb 9 '17 at 0:08
  • $\begingroup$ what are the $z_{i,j}$'s? $\endgroup$ – user251257 Feb 9 '17 at 0:10
  • $\begingroup$ They are interpolated from the given data, with the knowledge that the data is fairly radially symmetric. $\endgroup$ – eeScott Feb 9 '17 at 0:12
  • $\begingroup$ I am confused. What are the data given and what are you looking for? $\endgroup$ – user251257 Feb 9 '17 at 0:14

Assume that $x_1,\dotsc,x_m$, $y_1,\dotsc,y_n$, and $u_1,\dotsc,u_m$, $v_1,\dotsc,v_n$ are given. Assume that there is a function $f:\mathbb R^2 \to \mathbb R$ with $$ f(x_i,0) = u_i $$ and $$ f(0,y_j) = v_j. $$ Further, assume there is a function $g:[0,\infty)\to\mathbb R$ with $$f(x,y) = g(x^2 + y^2).$$

Now, "find" $g$:

Since you said the field looks "gaussian", let us assume $$ g(t^2) = b \exp(a t^2). $$ That is, we have $$ \log(f(x_i,0)) = \log(g(x_i^2)) = \log(b) + a x_i^2 = \log(u_i) $$ and $$ \log(f(0,y_j)) = \log(g(y_j^2)) = \log(b) + a y_j^2 = \log(v_j), $$ or as matrix equation $$ \underbrace{\begin{bmatrix}1 & x_1^2 \\ \vdots \\ 1 & x_m^2 \\ 1 & y_1^2 \\ \vdots \\ 1 & y_n^2 \end{bmatrix}}_{A} \underbrace{\begin{bmatrix}\log(b) \\ a \end{bmatrix}}_{\beta} = \underbrace{\begin{bmatrix}\log u_1 \\ \vdots \\ \log u_m \\ \log v_1 \\ \vdots \\ \log v_n \end{bmatrix}}_{w}. $$ Taking a least squares approach yield the estimator $$ \hat\beta = (A^T A)^{-1} A w. $$

  • $\begingroup$ This is great! Thanks for the detailed explanation. $\endgroup$ – eeScott Feb 9 '17 at 19:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.