MATLAB: How to pass function as argument ?

equationfunctionMATLAB

Develop an M-file for the bisection method. Along with the two initial guesses, pass the function as an argument.
i know how to develop M-file for bisection method but the problem i dont know how to pass the function as argument
ex : ?(?)=??^3−3x^?+2?−?
how can i make a program that can read that equation as argument ??

Best Answer

Read about anonymous functions.
f = @(x) 5*x^3-3*x^2+2*x-2 ;
Any value can be evaluated using:
f(1)
f(2)