南邮数学实验问题详解
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
第一次练习题
1、求032=-x e x 的所有根。
>>x=-5:0.01:5;y=exp(x)-3*x.^2;plot(x,y);grid on
>> fsolve('exp(x)-3*x.^2',-1)
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.
ans =
-0.4590
>> fsolve('exp(x)-3*x.^2',1)
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.
ans =
0.9100
>> fsolve('exp(x)-3*x.^2',4)
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.
ans =
3.7331
2、求下列方程的根。
1)0155=++x x 2) 至少三个根)(021
sin =-x x
3) 所有根0cos sin 2=-x x x
1) >> p=[1,0,0,0,5,1];r=roots(p)
r =
1.1045 + 1.0598i
1.1045 - 1.0598i
-1.0045 + 1.0609i
-1.0045 - 1.0609i
-0.1999
2) >> x=-10:0.01:10;y=x.*sin(x)-1/2;plot(x,y);grid on
>> fsolve('x.*sin(x)-1/2',-6)
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.
ans =
-6.3619
>> fsolve('x.*sin(x)-1/2',-4)
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.
ans =
-2.9726
>> fsolve('x.*sin(x)-1/2',2)
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.
ans =
0.7408
3) >> x=-3:0.01:3;y=sin(x).*cos(x)-x.^2;plot(x,y);grid on
>> fsolve('sin(x).*cos(x)-x.^2',-1)
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.
ans =
-6.8434e-010
>> fsolve('sin(x).*cos(x)-x.^2',1)
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.