MATLAB Using fminsearch for Minimization of Two Parameters: Matlab Help

  • Thread starter Thread starter birdhen
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
Using fminsearch in MATLAB can effectively help find the minimum chi-squared values for the parameters H and omega simultaneously. To implement this, define a function that calculates the chi-squared value based on H and omega. fminsearch requires this function and an initial condition vector as inputs, which should correspond to the two parameters being optimized. It's important to note that fminsearch may only find a local minimum, so the choice of initial conditions can significantly influence the results. For best results, consider experimenting with different starting points to avoid local minima.
birdhen
Messages
31
Reaction score
0
Hi there,

I am getting confused trying to use fminsearch. I have looked at the help on Matlab but can't seem to understand how to get it to work.

I would like to find the minimum chi squared values of two parameters H and omega. I have written a function that will find the min chi squared value of H keeping omega constant, and thought that I could put this into a loop for varying values of omega, so find best H value for each value of omega. Could I use fminsearch instead to find the best fit of both values at once?
I am confused about what I need to do and any help would be greatly appreciated.

Many thanks
 
Physics news on Phys.org
Sure, you can use fminsearch to find where the function is a minimum, but it will not necessarily be a global minimum - fminsearch can get stuck in a local minimum so your answer will depend on your initial conditions. I'm not sure what information I can provide outside of MATLAB's help - I assume you know how to define a function. Without using any of the options, fminsearch takes a function and an initial condition vector as inputs (yours is a function of 2 variables, so xo [the initial condition] will be a vector).
 
Back
Top