Want to use Matlab similar to Solver in Excel
22 views (last 30 days)
Hello, I am trying to use MATLAB to do what a solver in excel will be able to. I have a set of data I have collected experimentally (say Xexpt and Yexpt). I would like to use an *user defined non linear equation *( exponential equation relating y as a function of x but with two constants, A and B). I start with an initial guess value for A and B and calculate the corresponding Ycalc for each Xexpt value. I would like to minimize the square root of the sum of the difference in squares by changing the values of A and B. I could do this in excel by using Solver function, that minimizes the Sqrt (Sum (Yexpt^2-Ycalc^2)) by changing A and B. Can someone help me how i could do the same in Matlab ? Thanks in advance.
Christoph F. on 21 Sep 2017
I think you're looking for the fminsearch() function.
Or alternatively something from the curve fitting toolbox.