This chapter introduced
fzero, a function we can use to solve nonlinear equations. To use
fzero, you have to write an error function and pass a function handle as an argument. Using functions in this way can be tricky at first, but get comfortable with it, because we are going to use it a lot.
Here are some terms from this chapter you might want to remember.
If we can solve an equation by performing algebraic operations and deriving an explicit way to compute a value, the result is an analytic solution. Otherwise, we can use a numerical method, which finds a numerical solution to the equation, which is usually an approximation.
To solve nonlinear equations, we often rewrite them as functions and then find one or more zeros of the function, that is, arguments that make the value of the function \(0\).
A function handle is a way of referring to a function by name (and passing it as an argument) without calling it.
Finally, shadowing is a kind of name collision in which a new definition causes an existing definition to become invisible. In MATLAB, variable names can shadow built-in functions (with hilarious results).
In the next chapter, we’ll write functions that take vectors as inputs and return vectors as outputs.