Dear all, I would like to fit experimental data with custom equations. I aim for the best fit of the theoretical curve to the experimental data by minimizing the residuals and use fminsearch to find minimal error.
The attached code works well for the real inputs
[R, fval] = fminsearch(err, 2.11)% finds the minimum of err But it fails for the
[R, fval] = fminsearch(err, 2.0-0.064i)
Help for fminsearch suggests to input split into real, imaginary parts and work to obtain the best fit. I have a little idea of doing this.
Could somebody help me with this problem? Thanks all.