第一步:建立自定义函数文件 fun.m
function y = fun(x)
y=x^3-3*x^2-10;
第二步:在执行窗口中,执行下列语句
x0=-2;x1=-1;tol=1.0e-5;
secant(x0,x1,tol)
运行结果