Lecture 18 - MATLAB Function optimset The function optimset...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
The function optimset creates an options structure that you can pass as an input argument to the following four MATLAB optimization functions: fminbnd (single variable) local minimizer fminsearch (multi-variables) fzero lsqnonneg nonnegative least-squares constraints problem Example: options = optimset('Display','iter','TolFun',1e-8) This statement creates an optimization options structure in which the Display parameter is set to 'iter' and the TolFun parameter is set to 1e-8. MATLAB Function: optimset
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
>> options =optimset( 'display','iter' ); >> [x fx]=fzero(@(x) x^10-1,0.5, options ) Search for an interval around 0.5 containing a sign change: Func-count a f(a) b f(b) Procedure 1 0.5 -0.999023 0.5 -0.999023 init. intv 3 0.485858 -0.999267 0.514142 -0.998709 search 5 0.48 -0.999351 0.52 -0.998554 search 7 0.471716 -0.999454 0.528284 -0.998307 search 9 0.46 -0.999576 0.54 -0.997892 search 11 0.443431 -0.999706 0.556569 -0.997148 search 13 0.42 -0.999829 0.58 -0.995692 search 15 0.386863 -0.999925 0.613137 -0.992491 search 17 0.34 -0.999979 0.66 -0.984317 search 19 0.273726 -0.999998 0.726274 -0.959167 search 21 0.18 -1 0.82 -0.862552 search 23 0.0474517 -1 0.952548 -0.385007 search 25 -0.14 -1 1.14 2.70722 search fzero and optimset functions Find sign change after 25 iterations Switch to secant (linear) OR inverse quadratic interpolation to find root Search in both directions x 0 ± x for sign change
Image of page 2
>> [x fx]=fzero(@(x) x^10-1,0.5, options ) Search for a zero in the interval [-0.14, 1.14]:
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern