已知60=x*2*sin(pi*74/(4*x)),用matlab解此方程的语句该怎么写?
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/20 11:35:58
已知60=x*2*sin(pi*74/(4*x)),用matlab解此方程的语句该怎么写?
已知60=x*2*sin(pi*74/(4*x)),用matlab解此方程的语句该怎么写?
已知60=x*2*sin(pi*74/(4*x)),用matlab解此方程的语句该怎么写?
solve('60=x*2*sin(pi*74/(4*x))')
ans =
-31.281066120310786755821961868485
不过函数是偶函数,31.281066120310786755821961868485也因该是一个解,
通过绘图也可以看出
当然也可以用数值方法,但是对初值的依赖很大,你可以先绘图大致确定解的位置.
在图可以看出解大约在30和-30左右所以有以下程序
>> f=@(x)60-x*2*sin(pi*74/(4*x));
>> fsolve(f,-30)
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance,and
the problem appears regular as measured by the gradient.
<stopping criteria details>
ans =
-31.2811
>> fsolve(f,30)
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance,and
the problem appears regular as measured by the gradient.
<stopping criteria details>
ans =
31.2811