From the header of surface1.c

If your dataset is a vector (tx, tz), what are the y values?Contents: Example for fitting data y_i(t_i) by a function f(t;p), where each t_i is a vector of dimension k=2.

And if you really have a 2D-vector, your callback function (f) needs three parameters (see the model function in surface1.c)

I don't understand what your algorithm should produce. Does your algorithm generate different functions and you want to find the best?

Curve fitting is about finding a function which fits a set of data points best. The library uses the Levenberg-Marquardt algorithm for that. You have to provide a dataset and a general function (with some modifiable parameters). Then the library finds the parameter combination which fits best.

So I don't see where your algorithm fits here (especially the variable "Fitted_Curve" suggests that you try to calculate the curve yourself).

Bye, Andreas