- #1
yohak
- 4
- 0
Homework Statement
I need to find the roots of some functions using the bisection method, secant method, etc in Matlab. I have the m-files written, but I'm having trouble putting the function [tex]F(x)=e^{-0.5x}(4-x)-2[/tex] into Matlab. I had no problem with [tex]F(x)=0.95x^{3}-5.9x^{2}-6[/tex] but I don't know what to do about the exponential.
I'm also having trouble getting feval to work. I got around it by using polyval, but although it works for [tex]F(x)=0.95x^{3}-5.9x^{2}-6[/tex] I don't know if it will work for every function.
Homework Equations
none
The Attempt at a Solution
I'm kind of new to Matlab, but I understand that polynomials are entered as a single row vector (example: [tex]F(x)=0.95x^{3}-5.9x^{2}-6[/tex] is entered as [0.95 -5.9 0 -6]) but I don't know how to put this function in since it is an exponential.
Is polyval a valid solution to the feval issue? The error says "Argument must contain a string or function_handle" but I don't know what that means.