I tried the curve fitting toolbox in Matlab but it was limited to 2 independent variables. I read about the linear regression function in Matlab but I am not sure if it can produce the equation governing the relation.
You can use Optimisation Toolbox for your problem. Your objective function will be The second power of the sum of the differences between your real data and your considerable function and the independent variables (the coefficients) will be your optimisation variables, which lead your objective function to the lowest amount that is possible.
It allows you to fit any nonlinear function with as many parameters as you want, as far as I understand it. I used it lately for fitting 2 parameters and holding another one constant. Sometimes changing my guess for the constant parameter.
However, I warn you: According to my experience, fitting nonlinear functions with at least 2 parameters, will very likely result in some very local minimum. That means that your results might very strongly depend on the initial assumption for the fit parameters! I recommend always plotting the resulting fit curve compared to your data and with a bit of trial and error guessing the fit parameter values better and better until you are satisfied with the solution (by e.g. the looks of the plot or your personal weighted measure of deviation between fit curve and data).