I need to describe the optical aberrations of my set-up with Zernike polynomials. To do this, I want to fit the first 15 polynomials in the following way on my data:$$\chi^2 = \sum_k\left(\beta_k^x - \sum_{n=2}^M C_n\frac{\partial P_n}{\partial x}\right)^2 + \sum_k\left(\beta_k^y - \sum_{n=2}^M C_n\frac{\partial P_n}{\partial y}\right)^2$$where $\beta_x$ and $\beta_y$ are my data, $P_n$ are the Zernike polynomials, and $C_n$ are the coefficients. Because the coefficients $C_n$ for both the $x$ and $y$ derivative of the polynomial needs to be the same, I do not think I can use a normal polynomial least square. I need to do this in Labwindows/CVI.Does anyone have an idea how to approach this problem? 
Least Square fit with Double Zernike Polynomials
least squares