
是不是用fzero函数,具体怎么编?
你好档斗早
先在桌面建立sfun.m文销核件
function eq=sfun(x)
eq= cos(x)*cosh(x)+1
然后matlab运行
>> [y,fv,ef,out]=fzero(@sfun,1.8)
eq =
0.2940
eq =
0.4748
eq =
0.0983
eq =
0.5454
eq =
0.0128
eq =
0.6413
eq =
-0.1128
eq =
0.0154
eq =
2.9941e-004
eq =
-2.6389e-008
eq =
1.4014e-012
eq =
2.2204e-016
eq =
-3.5527e-015
y =
1.8751
fv =
2.2204e-016
ef =
1
out =
intervaliterations: 3
iterations: 6
funcCount: 13
algorithm: 'bisection, interpolation'行雀
message: 'Zero found in the interval [1.69818, 1.90182]'
希望对你有帮助