I want to fit a line generated from a function to a set of datapoints, similar to adding a trendline to a chart. However, none of the trendlines are suitable.

1) I am using a comparatively complex function with a number of variables (4 or 5, as well as the ordinate).

2) The datapoints are from a real world measurement - I'm never going to get an exact result, only a best fit.

Is there any way to automatically calculate this or do I have to adjust the variables manually until the graph fits closely to the datapoints by eye?

I'll be very grateful for any advice.