bisect.m
资源名称:speech.rar [点击查看]
上传用户:ay_070428
上传日期:2014-12-04
资源大小:11427k
文件大小:1k
源码类别:
语音合成与识别
开发平台:
Matlab
- function [c,err,yc]=bisect(f,a,b,delta)
- %缩小范围,
- %input-f is the function input as a string'f'
- % -a and b are the left and right end points
- % -delta is the tolerance
- % output-c is the zero
- % -yc=f(c)
- % -err is the error estimate for c
- ya=feval(f,a);%对函数F进行计算
- yb=feval(f,b);
- if ya*yb>0,break,end
- max1=1+round((log(b-a)-log(delta)/log(2));%????
- for k=1:max1
- c=(a+b)/2;
- yc=feval(f,c);
- if yc==0
- a=c;
- b=c;
- elseif yb*yc>0
- b=c;
- yb=yc;
- else a=c;
- ya=yc;
- end
- if b-a<delta,break,end
- end
- c=(a+b)/2;
- err=abs(b-a);
- yc=feval(f,c);