MATLAB程序设计与应用(第三版)刘卫国 答案(六) 您所在的位置:网站首页 试验设计第三版答案第一章 MATLAB程序设计与应用(第三版)刘卫国 答案(六)

MATLAB程序设计与应用(第三版)刘卫国 答案(六)

#MATLAB程序设计与应用(第三版)刘卫国 答案(六)| 来源: 网络整理| 查看: 265

第六章 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。

三、应用题 A=randn(10,5)

A = 0.7254 0.7172 -1.0689 0.3192 -1.2141 -0.0631 1.6302 -0.8095 0.3129 -1.1135 0.7147 0.4889 -2.9443 -0.8649 -0.0068 -0.2050 1.0347 1.4384 -0.0301 1.5326 -0.1241 0.7269 0.3252 -0.1649 -0.7697 1.4897 -0.3034 -0.7549 0.6277 0.3714 1.4090 0.2939 1.3703 1.0933 -0.2256 1.4172 -0.7873 -1.7115 1.1093 1.1174 0.6715 0.8884 -0.1022 -0.8637 -1.0891 -1.2075 -1.1471 -0.2414 0.0774 0.0326

(1)

avg=mean(A)%平均值

avg = 0.4828 0.3542 -0.4499 0.1616 -0.1365

sd=std(A)%标准差

sd = 0.8749 0.8601 1.3360 0.6901 0.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,'descend')

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.6715 0.4889 0.0774 -0.2256 -0.7549 0.7172 0.7147 0.3129 -0.0068 -0.2414 0.7269 0.7254 0.3192 0.0326 -0.1022 1.4090 0.8884 0.6277 0.3714 0.3252 1.4172 1.3703 1.1174 1.0933 1.0347 1.6302 1.5326 1.4897 1.4384 1.1093

(1)

P1=[3,2]; P2=[5,-1,2]; P3=[1,0,-0.5]; P=conv(conv(P1,P2),P3) P=poly2str(P,'x')

P = 15.0000 7.0000 -3.5000 0.5000 -2.0000 -2.0000 P= ’ 15 x^5 + 7 x^4 - 3.5 x^3 + 0.5 x^2 - 2 x - 2’

(2)

rs=roots(P)

rs = 0.7071 + 0.0000i 0.1000 + 0.6245i 0.1000 - 0.6245i -0.7071 + 0.0000i -0.6667 + 0.0000i

(3)

t=0:10; x=0.2.*t; Pval=polyval(P,x);

Pval = -2.0000 -2.3920 -2.6112 -1.7024 2.7104 15.0000 42.1120 94.1408 184.9056 332.5264 560.0000

a=0:15:90; a1=0:1:90; ta=0:15:75; ta1=0:1:75; sina=[0,0.2588,0.5000,0.7071,0.8660,0.9659,1.0000]; tana=[0,0.2679,0.5774,1.0000,1.7320,3.7320]; Ysina1=interp1(a,sina,a1,'spline'); Ytana1=interp1(ta,tana,ta1,'spline'); subplot(1,2,1) plot(a1,Ysina1,ta1,Ytana1) legend('正弦值','正切值') title('三次样条插值计算') subplot(1,2,2) P1=polyfit(a,sina,5); Ysina2=polyval(P1,a1); P2=polyfit(ta,tana,5); Ytana2=polyval(P2,ta1); plot(a1,Ysina2,ta1,Ytana2); legend('正弦值','正切值') title('五次多项式拟合计算')

在这里插入图片描述 通过图片可以看出两种方式的计算结果相差不大。 4.

t=1:5; tp=1:0.02:5; x=[165,123,150,123,141]; y=[187,126,172,125,148]; xp=polyfit(t,x,3); yp=polyfit(t,y,3); xval=polyval(xp,tp); yval=polyval(yp,tp); plot(tp,xval,tp,yval); legend('x(i)','y(i)')

在这里插入图片描述 若想要讲解可下方留言,看到就会回复!!!



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有