Numerical methods are commonly used for solving mathematical problems that are formulated in science and engineering where it is difficult or impossible to obtain exact solutions. MATLAB has a large library of functions for numerically solving a wide variety of mathematical problems. This chapter explains a number of the most frequently used of these functions. It should be pointed out here that the purpose of this book is to show users how to use MATLAB. Some general information on the numerical methods is given, but the details, which can be found in books on numerical analysis, are not included.
The following topics are presented in this chapter: solving an equation with one unknown, finding a minimum or a maximum of a function, numerical integration, and solving a first-order ordinary differential equation.
An equation with one variable can be written in the form f(x) = 0. A solution to the equation (also called a root) is a numerical value of x that satisfies the equation. Graphically, a solution is a point where the function f(x) crosses or touches the x axis. An exact solution is a value of x for which the value of the function is exactly zero. If such a value does not exist or is difficult to determine, a numerical solution can be determined by finding an x that is very close to the solution. This is done by the iterative process, where in each iteration the computer determines a value of