欢迎来到天天文库
浏览记录
ID:38637658
大小:289.50 KB
页数:11页
时间:2019-06-16
《测控软件技术基础周鑫》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、测控软件技术基础姓名:周鑫班级:232131学号:20131000982指导老师:黄玉金BasicSyntaxandCommand-LineExercises1.Createavectoroftheevenwholenumbersbetween31and75.代码:x=32:2:752.Letx=[2516].a.Add16toeachelementb.Add3tojusttheodd-indexelementsc.Computethesquarerootofeachelementd.Computethesquareofeachelement代码:a=x+16;b=x(1:2:e
2、nd)+3c=sqrt(x)d=x.^25.Createavectorxwiththeelements...代码:a=2:2:20b=10:-2:-4c1=1:5,c2=1./c1,rats(c2)d1=0:4,d2=1:5,d3=d1./d2,rats(d3)6.Createavectorxwiththeelements,xn=(-1)n+1/(2n-1)Adduptheelementsoftheversionofthisvectorthathas100elements.代码:n=1:100;x=((-1).^(n+1))./(2*n-1);y=sum(x)10.Makeago
3、odplot(i.e.,anon-choppyplot)ofthefunctionf(x)=sin(1/x)for0.014、.x(1:end)d.x(1:end-1)e.x(6:-2:1)f.x([16211])g.sum(x)答:x(3)表示x行向量中的第三个元素。x(1:7)表示x行向量中第1到7个元素。x(1:end)表示x行向量中第1到最后一个元素。x(1:end-1)表示x行向量中第1到倒数第二个元素。x(6:-2:1)表示x行向量中第6个元素到第1个元素中的偶数项元素。x([16211]):方括号中表示x行向量中元素的序号,整个表示由这些元素组成的新行向量。sum(x):表示x中所有元素求和。2.GiventhearrayA=[241;672;359],providethecommands5、neededtoa.assignthefirstrowofAtoavectorcalledx1b.assignthelast2rowsofAtoanarraycalledyc.computethesumoverthecolumnsofAd.computethesumovertherowsofAe.computethestandarderrorofthemeanofeachcolumnofA(NB.thestandarderrorofthemeanisdefinedasthestandarddeviationdividedbythesquarerootofthenumberofel6、ementsusedtocomputethemean.)代码:A=[241;672;359]x1=A(1,:)y=A(end-1:end,:)c=sum(A)d=sum(A,2)N=size(A,1),e=std(A)/sqrt(N)6.GivethefollowingcommandstocreateanarraycalledF:>>randn('seed',123456789)>>F=randn(5,10);a.Computethemeanofeachcolumnandassigntheresultstotheelementsofavectorcalledavg.b.Compu7、tethestandarddeviationofeachcolumnandassigntheresultstotheelementsofavectorcalleds.c.Computethevectoroft-scoresthattestthehypothesisthatthemeanofeachcolumnisnodifferentfromzero.d.IfPr(8、t9、>2.132)=0.1with4degreesoffreedom,areanyofthemeanvaluesi
4、.x(1:end)d.x(1:end-1)e.x(6:-2:1)f.x([16211])g.sum(x)答:x(3)表示x行向量中的第三个元素。x(1:7)表示x行向量中第1到7个元素。x(1:end)表示x行向量中第1到最后一个元素。x(1:end-1)表示x行向量中第1到倒数第二个元素。x(6:-2:1)表示x行向量中第6个元素到第1个元素中的偶数项元素。x([16211]):方括号中表示x行向量中元素的序号,整个表示由这些元素组成的新行向量。sum(x):表示x中所有元素求和。2.GiventhearrayA=[241;672;359],providethecommands
5、neededtoa.assignthefirstrowofAtoavectorcalledx1b.assignthelast2rowsofAtoanarraycalledyc.computethesumoverthecolumnsofAd.computethesumovertherowsofAe.computethestandarderrorofthemeanofeachcolumnofA(NB.thestandarderrorofthemeanisdefinedasthestandarddeviationdividedbythesquarerootofthenumberofel
6、ementsusedtocomputethemean.)代码:A=[241;672;359]x1=A(1,:)y=A(end-1:end,:)c=sum(A)d=sum(A,2)N=size(A,1),e=std(A)/sqrt(N)6.GivethefollowingcommandstocreateanarraycalledF:>>randn('seed',123456789)>>F=randn(5,10);a.Computethemeanofeachcolumnandassigntheresultstotheelementsofavectorcalledavg.b.Compu
7、tethestandarddeviationofeachcolumnandassigntheresultstotheelementsofavectorcalleds.c.Computethevectoroft-scoresthattestthehypothesisthatthemeanofeachcolumnisnodifferentfromzero.d.IfPr(
8、t
9、>2.132)=0.1with4degreesoffreedom,areanyofthemeanvaluesi
此文档下载收益归作者所有