11-Using-fzero-and-Applications-4UP

11-Using-fzero-and-Applications-4UP - fzero Nonlinear...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fzero Nonlinear problems with parameters More on Newton Using fzero and Applications Dhavide Aruliah UOIT MATH 2072U c D. Aruliah (UOIT) Using fzero and Applications MATH 2072U 1 / 23 fzero Nonlinear problems with parameters More on Newton Using fzero and Applications 1 Using MATLABs fzero 2 Solving nonlinear equations with parameters 3 More on Newton-based algorithms c D. Aruliah (UOIT) Using fzero and Applications MATH 2072U 2 / 23 fzero Nonlinear problems with parameters More on Newton fzero MATLAB has practical zero-finding routine fzero Can specify initial interval I ( ) = [ a ( ) , b ( ) ] bracketing zero f = @(x) x-cos(x) % Function to find zeros I0 = [0.5, 1.0]; % Initial interval x = fzero( f, I0 ) Alternatively, fzero accepts a single value x ( ) as initial iterate f = @(x) x-cos(x) % Function to find zeros x0 = 1.0; % Initial iterate x = fzero( f, x0 ) c D. Aruliah (UOIT) Using fzero and Applications MATH 2072U 4 / 23 fzero Nonlinear problems with parameters More on Newton fzerogui : Illustration of algorithm for fzero Graphical interface to fzero Can select iterates with mouse Iterates generated from either I bisection method I secant method I inverse quadratic interpolation (IQI) Some examples to try: I x 3- 2 x- 5 on [ 0, 3 ] I ln ( x + 2/3 ) on [ 0, 1 ] c D. Aruliah (UOIT) Using fzero and Applications MATH 2072U 5 / 23 fzero Nonlinear problems with parameters More on Newton Syntax for fzero x = fzero(fun,x0) x = fzero(fun,x0,options) [x,fval] = fzero(...) [x,fval,exitflag] = fzero(...) [x,fval,exitflag,output] = fzero(...) options is a structure whose fields can specify, display preferences, tolerances, maximum number of iterations, etc. fzero is a function function : expects function handle fun as input c D. Aruliah (UOIT) Using fzero and Applications MATH 2072U 6 / 23 fzero Nonlinear problems with parameters More on Newton Nonlinear functions with parameters Parametrised families of nonlinear equations are common e.g., sin x + e- x 2 /2 = where , R Possible approaches to solve parametrised equations 1 use extra parameters as global variables in function m-files 2 define functions to accept extra parameters & use solvers that accept variable length lists of inputs (c.f. bisection.m , newton ) 3 use anonymous functions to encapsulate functions with fixed parameter values We have seen first approach already (c.f. GPS problem)We have seen first approach already (c....
View Full Document

Page1 / 5

11-Using-fzero-and-Applications-4UP - fzero Nonlinear...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online