MATLAB: Fitting experimental and theoretical values

curve fittingfittinggraphtransfer function

Hi all,
I have a question regarding fitting of a graph. I cannot divulge too much information as it is confidential. But, I would try my best to clearly explain my question.
I have theoretical values of a function as an array of 501 elements. Also, I have corresponding experimental values, not for the entire range, but for intermediate steps (e.g.: experimental values for 1, 45, 100,….501). I have to fit both these arrays using another function X. The function X has 25 values. Each of these values can be adjusted to get the best fit of theoretical and experimental data. The adjustment can be from 0 to 1.00 in steps of 0.01. Changing each value will have a subsequent independent effect on the fit. I need to find the best 25 values of function X that could lead to the best fit of theoretical and experimental data.
I have searched online to get some information but I am still at the starting point and I am not sure about the way to approach this question.
Thanks a lot, Cheers, Srikanth.

Best Answer

What you want to do is termed ‘parameter estimation’. There are several MATLAB functions in various toolboxes that will do that, for example the Optimization Toolbox function lsqcurvefit, Statistics Toolbox nlinfit, and the Curve Fitting Toolbox.
That you want to estimate 25 parameters, even with 501 data pairs, may be difficult. The most important aspect to consider is that the ‘best’ solution is highly dependent on your choice of initial parameter estimates (starting values). I would do exploratory analyses with much simpler functions (with much fewer parameters) to get an idea of the parameter range that will likely be most successful. The problem with a large parameter set is that you are likely to encounter many local minima (false solutions) before you find the global minimum (best solution). The best solution is the solution with the lowest residual error.
Depending on the form of your objective function (the function you want to fit to your data), a unique set of estimated parameters may not be possible.
This is a complex topic, and I suggest you do some research on ‘nonlinear parameter estimation’ before you begin your project. While you can simply give data and your objective function to the nonlinear parameter estimation routines in MATLAB, if you have no idea how they work and the theoretical basis of nonlinear parameter estimation, this could become a very frustrating experience for you.