Question: The question is about Optimization or Numerical linear algebra with MATLAB,please help, thanks Optimization 3 Use of fminsearch (generic function): Now we can use the
Optimization 3 Use of fminsearch (generic function): Now we can use the MATLAB minimization function fminsearch to try to minimize the distance apart of the planets and hence find when they collide. Type help fminsearch and try [t, fval , exi tval , output] =fninsearch (@dist, [0,0)) where [0,0] is the initial guess and Odist tells matlab to use the dist.m function The function value at the final point is returned in fval, and the final pair (t1, t2) in t The variable exitflag tells us if fminsearch thinks has succeeded. The structure output tells about how much work was done We can control how accurately fminsearch finds the minimum via the function optimset For example to see the steps in this method type options-optimset ('Display, 'iter'); [t,fval,exitflag,output]-fminsearch (odist, [o;0],options) fminsearch has default accuracy parameters that you can change. To find the relevant options for fminsearch type options optimset ('fminsearch') Now lets demand a more accurate solution and track progress by modifying the options array and recalculating options = opt inset (options, 'Display',' iter , ,,TolX',1.e-5,,TolFun ,,1.e-5); [t, fval ,exitflag, output] =fninsearch (@dist, [0,0], options) You can see we iterated for longer, but we got a more accurate solution i.e. the final fval is smaller). Hand in a script for the matlab and a copy of your screen output. Can you find out what method fminsearch used
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
