实验一MATLAB基本操作及运算(含实验报告)._第1页
实验一MATLAB基本操作及运算(含实验报告)._第2页
实验一MATLAB基本操作及运算(含实验报告)._第3页
实验一MATLAB基本操作及运算(含实验报告)._第4页
实验一MATLAB基本操作及运算(含实验报告)._第5页
已阅读5页,还剩28页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、实验一 MATLAB基本操作及运算实验目的111、理解Matlab数据对象的特点;2、掌握基本Matlab运算规则;3、掌握Matlab帮助的使用方法;实验的设备及条件计算机一台(带有MATLAB7.0以上的软件环境)三、实验内容要求建立一个名为experimentOl.m的,把与实验内容1-7相关的实验命 令都放入该文件中,题与题之间用相应注释分割。注意对实验中出现的相关 函数或变量,请使用help或doc查询相关帮助文档,学习函数的用法。1、建立以下标量:1)a=102)b=2.5X 10233)c=2+3i, (i为虚数单位)4) d=ej23, (j为虚数单位,这里要用到exp, pi

2、)2、建立以下向量:1)aVec=3.14 15 9 262.71182)bVec=28.182 一3)cVec=5 4.8-4.8 -5 (向量中的数值从 5到-5,步长为-0.2)4)dVec=1(f 100.01100.99 101(产生1到10之间的等对数间 隔向量,参考logspace注意向量的长度)3、建立以下矩阵:2 21) aMat = - +i-M2_aMat 一个9X9的矩阵,其元素全为 2;(参考ones或zeros-1 0010匕0+2) bMat =:0503+0+0-0-01 _bMat是一个9 X 9的矩阵,除主对角上的元素为1 2 3 4 5 4 3 2 1夕卜

3、,其 余元素均为0。(参考diag )。1 11912 12匕 923) cMat =:10 20 100cMat为一个10X 10的矩阵,可有1:100的向量来产生(参考 reshapeNaNNaNNaNNaN 4) dMat =NaNNaNNaNNaNiNaNNaNNaNNaNdMat为3 X 4的NaN矩阵,(参考nan)13-15 I5)eMat 二IL 22 10-876)产生一个5X 3随机整数矩阵fMat,其值的范围在-3到3之间。(参考 rand和 floor或 cei)4、使用题1中的变量计算下列等式的x,y,z的值:1)-e(4a45)/6)2) y =(中右十离诂)71,

4、提示gE = h1/g,参考sqrt3) zOg(R(C a)(c d)sina/3),其中R表示取括号内复数的实cc数部分,c表示c的共轭复数,log是自然对数。(参考real,conj, log)5、使用题2中的向量求解一下等式:1)-cVec2 /(2.252) e1xVec 二他 2.52其中cVec指的是题2中定义的向量cVec,下雷同。2) yVec = (aVecT)2 bVec2 , aVecT 表示 aVec 的转置 3)zVec= log10(1/dVec),log10 表示已 10 为底的对数,参考 logio6、使用题2和题3中所产生的向量和矩阵计算以下等式,注意本题的

5、操作均采用矩阵间的运算。21) xMat = (aVec bVec) aMat 2) yMat =bVec aVec,注意这里与aVec bVec是不一样的3) zMat = cMat (aMat bMat)T ,这里cMat为cMat所对应行列式的值,参考 det。7、函数的使用和矩阵的访问。1) 计算矩阵cMat每一列的和,结果应为行向量形式。(参考sum)2) 计算eMat每一行的平均值,结果应为列向量形式。(参考mean)3)用向量111替换eMat的最上一行的值4)将cMat的第29行,第2到9列的元素所构成的矩阵赋值给 cSubo5) 使用函数rand产生一个1 x 5的向量r,并

6、将r中值小于0.5的元素设置 为0。(参考find)四、实验报告要求(包含预习报告要求和最终报告要求)1. 实验名称预习报告要求最终报告要求2. 实验目的3. 实验设备及条件4. 实验内容及要求5. 实验程序设计指程序代码。6. 实验结果及结果分析实验结果要求必须客观,有数据的可以记录数据,没有数据的简单描述实验 现象。结果分析是对实验结果的理论评判。7. 实验中出现的问题及解决方法8. 思考题的回答四、实验报告的提交方式Word文档,命名方式:实验号_你的学号姓名; 例如本次实验:实验一 _000000001_张三.docE_mail: matlab_xx01下一次课前提交,过期不收!五、参

7、考文献参考教材和Matlab帮助文件1. 实验名称MATLAB基本操作及运算2. 实验目的(1) 理解Matlab数据对象的特点;(2) 掌握基本Matlab运算规则;(3) 掌握Matlab帮助的使用方法;3. 实验设备及条件计算机一台(带有MATLAB7.C以上的软件环境)4. 实验内容及要求要求建立一个名为experimentOl.m的,把与实验内容1-7相关的实验命令都 放入该文件中,题与题之间用相应注释分割。注意对实验中出现的相关函数或变 量,请使用help或doc查询相关帮助文档,学习函数的用法。5. 实验程序设计clcformat compactformat lo ng g%1.

8、1A=10%1.2b=2.5*10A23%1.3c=2+3*i%1.4 d=exp(j*2*pi)/3)%2.1aVec=3.14 15 9 26%2.2bVec=2.71 8 28 182%2.3cVec=5:-0.2:-5%2.4dVec=logspace(0,1,100)%3.1aMat=2*o nes+zeros(9)%3.2bMat=diag(1,2,3,4,5,4,3,2,1)%3.3x=1:1:100cMat=reshape(x,10,10)%3.4dMat=zeros(3,4)+nan%3.5eMat=13,-1,5;-22,10,-87%3.6 fMat=u nifrnd(-

9、2,5,4,3)%4.1x=1/(1+exp(-(A-15)/6)%4.2y=(sqrt(A)+bA(1/21)Api%4.3z=(log(real(c+d)*(c-d)*si n(A*pi/3)/(c*conj(c)%5.1xVec=exp(-cVec.A2/2.25A2)/sqrt(2*pi*2.5A2)%5.2yVec 仁 sqrt(aVec)A2/2+bVec.A2)%5.3zVec=log10(1./dVec)%6.1xMat=(aVec*bVec)*aMat.A2%6.2 yMat=bVec*aVec%6.3zMat=det(cMat)*(aMat*bMat)%7.1 cMat_s

10、um=sum(cMat,2)%7.2eMat_mea n=mea n( eMat,2)%7.3eMat_replace=eMat./eMat(1,:);o nes(1,3)%7.4cSub=cMat(cMat(2:9,:)%7.5fin a=ra nd(5,1)fin a1=fi nd(fi na0.5)fin a(fi na1)=06. 实验结果及结果分析第一大题A =10b =2.5e+023c =2 +3id =-0.5 +0.866025403784439i第二大题aVec =Columns 1 through 23.1415Colum ns 3 through 4926bVec =2

11、.71828182cVec =Colum ns 1 through 254.8Colum ns 3 through 44.64.4Columns 5 through 64.24Columns 7 through 83.83.6Columns 9 through 103.43.2Colum ns 11 through 1232.8Colum ns 13 through 142.62.4Colum ns 15 through 162.22Colum ns 17 through 181.81.6Colum ns 19 through 201.41.2Columns 21 through 221 0.

12、8Colum ns 23 through 240.60.399999999999999Colum ns 25 through 260.1999999999999990Colum n 5113Colum ns 27 through 28-0.199999999999999Colum ns 29 through 30-0.6Columns 31 through 32-1Colum ns 33 through 34-1.4Colum ns 35 through 36-1.8Colum ns 37 through 38-2.2Colum ns 39 through 40-2.6Colum ns 41

13、through 42-3Colum ns 43 through 44-3.4Colum ns 45 through 46-3.8Colum ns 47 through 48-4.2Colum ns 49 through 50-4.6-0.399999999999999-0.8-1.2-1.6-2-2.4-2.8-3.2-3.6-4-4.4-4.8-5191.072267222010321.123324032978031.1768119524351.232846739442071.291549665014881.353047774579811.417474162926811.4849682622

14、54471.555676143930471.629750834620641.707352647470691.788649529057431.87381742286038dVec =Columns 1 through 211.02353102189903Columns 3 through 41.04761575278966Columns 5 through 61.09749876549306Columns 7 through 81.14975699539774Columns 9 through 101.20450354025878Colum ns 11 through 121.261856883

15、06602Colum ns 13 through 141.32194114846603Colum ns 15 through 161.38488637139387Colum ns 17 through 181.45082877849594Colum ns 19 through 201.51991108295293Columns 21 through 221.59228279334109Columns 23 through 241.66810053720006Columns 25 through 261.74752840000768Colum ns 27 through 281.83073828

16、0295371.917910261672491.96304065004027Columns 31 through 322.009233002565052.05651230834865Colum ns 33 through 342.104904144512022.15443469003188Colum ns 35 through 362.205130739903052.25701971963392Colum ns 37 through 382.310129700083162.36448941264541Colum ns 39 through 402.420128264794382.4770763

17、5599171Colum ns 41 through 422.535364493970112.59502421139974Colum ns 43 through 442.656087782946692.71858824273294Colum ns 45 through 462.782559402207122.8480358684358Colum ns 47 through 482.915053062825182.98364724028334Colum ns 49 through 503.053855508833423.12571584968824Columns 51 through 523.1

18、99267137797383.27454916287773Colum ns 53 through 543.351602650938843.43046928631492Columns 55 through 563.511191734215133.59381366380463Colum ns 57 through 583.678379771828633.76493580679247Colum ns 59 through 603.853528593710533.94420605943766Columns 61 through 624.03701725859655Columns 63 through

19、644.2292428743895Columns 65 through 664.43062145758388Columns 67 through 684.64158883361278Columns 69 through 704.86260158006535Columns 71 through 725.09413801481638Columns 73 through 745.33669923120631Columns 75 through 765.59081018251222Colum ns 77 through 785.85702081805667Columns 79 through 806.

20、13590727341317Columns 81 through 826.42807311728432Columns 83 through 846.73415065775082Columns 85 through 867.05480231071864Colum ns 87 through 887.39072203352578Columns 89 through 904.132012400115344.328761281083064.534878508128584.75081016210284.977023564332115.214008287999685.462277217684345.722

21、367659350225.994842503189416.280291441834256.579332246575686.89261210434977.220809018385467.564633275546297.924828983539177.742636826811278.111308307896878.30217568131975Colum ns 93 through 948.497534359086448.69749002617784Colum ns 95 through 968.902150854450399.11162756115489Colum ns 97 through 98

22、9.32603346883229.54548456661834Columns 99 through 1009.7700995729922510第三大题aMat=22222 222222222 222222222 222222222 222222222 222222222 222222222 222222222 222222222 2222bMat=10000 000002000 000000300 000000040 000000005 000000000 400000000 030000000 0020182736455463728190998182830 0 0 0 0 0001x =Co

23、lumns 1 through 9123456789Colum ns 10 through 181011121314151617Colum ns 19 through 2719 20 212223242526Colum ns 28 through 362829303132333435Colum ns 37 through 45373839 40 41424344Colum ns 46 through 5446 47 48 4950515253Colum ns 55 through 635556575859606162Colum ns 64 through 7264 65 66 67686970

24、71Columns 73 through 817374757677787980Colum ns 82 through 908283848586878889Columns 91 through 999192939495969798Colum n 100100cMat =Colum ns 1 through 91112131415161712122232 42526272313 2333 4353637333414243444546474845152535455565758561626364656667686717273747576777878182838485868788891929394959

25、697989102030405060708090Colum n 10919293949596979899100dMat =NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNeMat =13-15-2210 -87fMat =Columns 1 through 24.650904996030234.23909276304231-0.3820304049799853.334677831191762.247898084792511.195273656178391.4018772809651-1.87047449726243Colum n 33.749850150066771.1

26、12923550472362.308026436700663.54355926198925第四大题x =0.302940716034593y =6269.60314420271 z =0.104633566196183第五大题xVec =Columns 1 through 20.0011436837460341Columns 3 through 40.00244189145989572Columns 5 through 60.004894350444668Columns 7 through 80.00920899141861331Columns 9 through 100.0162658728

27、660145Colum ns 11 through 120.026970622986521Colum ns 13 through 140.04198100994748930.001684409239778910.003484513663248440.006766826289906910.01233605177531630.02111133213919060.0339159036499670.0511492707968797Colum ns 15 through 160.061342728003881Colum ns 17 through 180.0841436968344532Colum ns

28、 19 through 200.10834986912344Columns 21 through 220.130973517949181Colum ns 23 through 240.148623297923735Colum ns 25 through 260.158321025606789Colum ns 27 through 280.158321025606789Colum ns 29 through 300.148623297923735Columns 31 through 320.130973517949181Colum ns 33 through 340.10834986912344

29、Colum ns 35 through 360.0841436968344532Colum ns 37 through 38 0.061342728003881Colum ns 39 through 400.0419810099474893Columns 41 through 420.026970622986521Colum ns 43 through 440.0162658728660145Colum ns 45 through 460.07241421045344770.0962401857329090.1200708000790530.140626334236390.1546123591

30、373430.1595769121605730.1546123591373430.140626334236390.1200708000790530.0962401857329090.07241421045344770.05114927079687970.0339159036499670.02111133213919060.01233605177531630.009208991418613310.00676682628990691Colum ns 47 through 480.0048943504446680.00348451366324844Colum ns 49 through 500.00

31、2441891459895720.00168440923977891Colum n 510.0011436837460341yVec1 =3.5034126220015813.285330255586428.7141080307225182.926214633114zVec =Colum ns 1 through 20 -0.0101010101010101Colum ns 3 through 4-0.0202020202020202-0.0303030303030304Columns 5 through 6-0.0404040404040404-0.0505050505050505Colum

32、ns 7 through 8-0.0606060606060606-0.0707070707070707Columns 9 through 10-0.0808080808080809-0.0909090909090909Colum ns 11 through 12-0.101010101010101-0.111111111111111Colum ns 13 through 14-0.121212121212121-0.131313131313131Colum ns 15 through 16-0.141414141414141-0.151515151515152Colum ns 17 thro

33、ugh 18-0.161616161616162-0.171717171717172Colum ns 19 through 20-0.181818181818182Columns 21 through 22-0.202020202020202Colum ns 23 through 24-0.222222222222222Colum ns 25 through 26-0.242424242424242Colum ns 27 through 28-0.262626262626263Colum ns 29 through 30-0.282828282828283Columns 31 through

34、32-0.303030303030303Colum ns 33 through 34-0.323232323232323Colum ns 35 through 36-0.343434343434343Colum ns 37 through 38-0.363636363636364Colum ns 39 through 40-0.383838383838384Colum ns 41 through 42-0.404040404040404Colum ns 43 through 44-0.424242424242424Colum ns 45 through 46-0.444444444444444

35、Colum ns 47 through 48-0.464646464646465-0.191919191919192-0.212121212121212-0.232323232323232-0.252525252525253-0.272727272727273-0.292929292929293-0.313131313131313-0.333333333333333-0.353535353535354-0.373737373737374-0.393939393939394-0.414141414141414-0.434343434343434-0.454545454545455-0.47474

36、7474747475Colum ns 49 through 50-0.484848484848485-0.494949494949495Columns 51 through 52-0.505050505050505-0.515151515151515Colum ns 53 through 54-0.525252525252525-0.535353535353535Columns 55 through 56-0.545454545454545-0.555555555555556Colum ns 57 through 58-0.565656565656566-0.575757575757576Co

37、lum ns 59 through 60-0.585858585858586-0.595959595959596Columns 61 through 62-0.606060606060606-0.616161616161616Colum ns 63 through 64-0.626262626262626-0.636363636363636Colum ns 65 through 66-0.646464646464647-0.656565656565657Colum ns 67 through 68-0.666666666666667-0.676767676767677Colum ns 69 t

38、hrough 70-0.686868686868687-0.696969696969697Columns 71 through 72-0.707070707070707-0.717171717171717Colum ns 73 through 74-0.727272727272727-0.737373737373737Colum ns 75 through 76-0.747474747474747-0.757575757575758Colum ns 77 through 78-0.767676767676768-0.777777777777778Colum ns 79 through 80-0

39、.787878787878788-0.797979797979798Columns 81 through 82-0.808080808080808-0.818181818181818Colum ns 83 through 84-0.828282828282828-0.838383838383838Colum ns 85 through 86-0.848484848484848-0.858585858585859Colum ns 87 through 88-0.868686868686869-0.878787878787879Colum ns 89 through 90-0.8888888888

40、88889-0.898989898989899Columns 91 through 92-0.909090909090909-0.919191919191919Colum ns 93 through 94-0.929292929292929-0.939393939393939Colum ns 95 through 96-0.94949494949495-0.95959595959596Colum ns 97 through 98-0.96969696969697-0.97979797979798Columns 99 through 100-0.98989898989899-1xMat =Colum ns 1 through 220450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.037620450.0376Colum ns 3 through 420450.037620450.037620450.037620450.037620450.037620450.037

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论