先画图看清正负!!!!!!F = @(x)4.*cos(x)-exp(x);x0 = pi/4;x1 = pi/2;num = 0;while abs(F(x1))>1e-4if F((x0+x1)/2) >= 0x0 = (x0+x1)/2;elsex1 = (x0+x1)/2;endnum = num+1;enddisp(num)disp(x1)另外两种方法去网上一搜一大把, 自己找吧