MATLAB程序设计与应用(第三版)刘卫国答案(六).pdf
MATLAB程序设计与应⽤(第三版)刘卫国答案(六)
第六章MATLAB数据分析于多项式计算
⼀、选题
1~6:CBDDCA
⼆、填空题
1.[15,27,39];[4,5,6]。
2.x^2-1。
3.x=roots(a,b,c);P=poly(x)。
4.⼀维插值;interp1
5.polyfit;polyval。
三、应⽤题
1.
A=randn(10,5)
A=
0.72540.7172-1.06890.3192-1.2141
-0.06311.6302-0.80950.3129-1.1135
0.71470.4889-2.9443-0.8649-0.0068
-0.20501.03471.4384-0.03011.5326
-0.12410.72690.3252-0.1649-0.7697
1.4897-0.3034-0.75490.62770.3714
1.40900.29391.37031.0933-0.2256
1.4172-0.7873-1.71151.10931.1174
0.67150.8884-0.1022-0.8637-1.0891
-1.2075-1.1471-0.24140.07740.0326
(1)
avg=mean(A)%平均值
avg=
0.48280.3542-0.44990.1616-0.1365
sd=std(A)%标准差
sd=
0.87490.86011.33600.69010.9483
(2)
maxA=max(max(A))
maxA=
1.6302
minA=min(min(A))
minA=
-2.9443
(3)
sumArow=sum(A,2)
sumA=
-0.5211
-0.0430
-2.6124
3.7707
-0.0066
1.4304
3.9409
1.1450
-0.4951
-2.4861
sumA=sum(sum(A))
sumA=
4.1228
(4)
sortA=sort(sort(A),2,desend)
sortA=
-0.8649-1.1471-1.2075-1.2141-2.9443
-0.2050-0.7873-0.8637-1.1135-1.7115
-0.1241-0.1649-0.3034-1.0689-1.0891
0.2939-0.0301-0.0631-0.7697-0.8095
0.67150.48890.0774-0.2256-0.7549
0.71720.71470.3129-0.0068-0.2414
0.72690.72540.31920.0326-0.1022
1.40900.88840.62770.37140.3252
1.41721.37031.11741.09331.0347
1.63021.53261.48971.43841.1093
2.
(1)
P1=[3,2];
P2=[5,-1,2];
P3=[1,0,-0.5];
P=onv(onv(P1,P2),P3)
P=poly2str(P,x)
P=
15.00007.0000-3.50000.5000-2.0000-2.0000
P=
’15x^5+7x^4-3.5x^3+0.5x^2-2x-2’
(2)
rs=roots(P)
rs=
0.7071+0.0000i
0.1000+0.6245i
0.1000-0.6245i
-0.7071