3469
MATLAB程式問題
昨天有問過了有人反應沒辦法一次po完所以在問一下一、請以MATLAB撰寫一個程式
使用遞增搜尋法(increment research)找出下列函式在區間【3
6】以及【3
100】的根(注意:非根的上下界限)f(x)=sin(x) cos(x)這次點數有喔
這是遞增搜尋法(increment research)的程式(Steven C. Chapra: Applied Numerical Methods with MATLAB for Engineers and Scients書中程式)function xb = incsearch(func
xmin
xmax
ns)% xb = incsearch(func
xmin
xmax
ns):% finds brackets of x that contain sign changes of % a function on an interval% input:% func = name of function % xmin
xmax = endpoints of interval% ns = (optional) number of subintervals along x% used to search for brackets % output:% xb(k
1) is the lower bound of the kth sign change% xb(k
2) is the upper bound of the kth sign change% If no brackets found
xb = [].if nargin