The nonlinear least squares solver doesn't care about the dimensionality of the data - its your job to handle that.
The 'f' vector is the vector of residuals, whose sum of squares is minimized by the solver. If you have a total of n residuals (ie: n data points), f_i = D_i - G(x_i,y_i,p) where G is your model (Gaussian) and p are the parameters. On 12/17/2014 08:11 PM, lzh...@nrao.edu wrote: > Hello, > > I'm trying to fit a two dimensional Gaussian function to many measured > data points D(x,y,z) which x and y are position coordinates and z is the > value of point (x,y). However there are some questions about data > dimension. > > I use "GSL nonlinear least squares fitting" to do the fitting. The two > dimensional Gaussian G(x,y,p1,p2,...,pn) is matrix which p1,p2,..pn are > parameters. However the f is gsl_vector * datatype in the function int (* > f) (const gsl_vector * x, void * params, gsl_vector * f) of > gsl_multifit_function_fdf. I'm wondering that if the nonlinear least > squares fitting only can deal with one-dimensional data?? If data is > higher dimensional, we need flat the higher-dimensional data into one > dimension? > > for two dimensional Gaussian model, the Jacobian is a cube which is (x,y,p). > > However If we flat the higher-dimensional data into one dimension, when we > fit the position parameter (x,y ...), Can I get the fitted parameters from > nonlinear least squares fitting directly? > > Bests > > Li > >