Question: MATLAB question Before we implement our own root-finding method, lets try one of MATLABs built-in root-finding method, fzero, to find the zeros of the function,
MATLAB question
Before we implement our own root-finding method, lets try one of MATLABs built-in root-finding method, fzero, to find the zeros of the function,
f(x) = xex 5. This is a transcendental equation that cannot be solved for in terms of elementary functions. Use
a function handle to define this function as follows, f = @(x) x.*exp(x) - 5;
Now MATLAB will recognize f as a function just like it recognizes cos or exp; for example, you can type f(5) to evaluate f(5).
Use the fzero command to find the roots of f(x). To do this you will need to use f and to supply an initial guess. Use an initial guess of x0 = 1 and save the root to file as A1.dat.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
