matlab画图:用二分法求方程x^3cosx+6sin^5x-3=0

狼在飞 1年前 已收到2个回答 举报

gyz_sw 幼苗

共回答了23个问题采纳率:82.6% 举报

用二分法,你得先找出一个根所在的区间
function [a,b]=findbracket(f,x0)
%f is the function evaluated
%x0 is the starting point
%a is the left boundary
%b is the right boundary
%[a,b] is the interval around x0 wanted
a=x0;
b=x0;
dx=0.001;
while f(a)*f(b)>0
a=a-dx;
if f(a)*f(b) f=@(x)(x^3)*cos(x)+6*(sin(x))^5-3
f =
@(x)(x^3)*cos(x)+6*(sin(x))^5-3
>> [a,b]=findbracket(f,1)
a =
0.9850
b =
1.0070
所以在这个区间内有一个根,然后再用二分法精确到0.00001
>> p=bisection(f,a,b,1e-5)
p =
0.9919
这是一个根

1年前

4

rr栋梁 幼苗

共回答了2个问题 举报

用二分法,你得先找出一个根所在的区间
function [a,b]=findbracket(f,x0)
%f is the function evaluated
%x0 is the starting point
%a is the left boundary
%b is the right boundary
%[a,b] is the interv...

1年前

1
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 18 q. 0.061 s. - webmaster@yulucn.com