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

下载本文档

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

文档简介

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

2、要用到exp,pi)2、 建立以下向量: 1) aVec=3.14 15 9 262) bVec=3) cVec=5 4.8 -4.8 -5 (向量中的数值从5到-5,步长为-0.2)4) dVec=100 100.01 100.99 101 (产生1到10之间的等对数间隔向量,参考logspace,注意向量的长度)3、 建立以下矩阵:1)aMat 一个9×9的矩阵,其元素全为2;(参考ones或zeros)2)bMat是一个9×9的矩阵,除主对角上的元素为1 2 3 4 5 4 3 2 1外,其余元素均为0。(参考diag )。3)cMat为一个10×10的矩阵

3、,可有1:100的向量来产生(参考reshape)4)dMat为3×4的NaN矩阵,(参考nan)5)6)产生一个5×3随机整数矩阵fMat,其值的范围在-3到3之间。(参考rand和floor或ceil)4、 使用题1中的变量计算下列等式的x,y,z的值:1)2) ,参考sqrt。3) ,其中R表示取括号内复数的实数部分,表示c的共轭复数,log是自然对数。(参考real,conj,log)5、 使用题2中的向量求解一下等式:1),其中指的是题2 中定义的向量,一下雷同。2),表示的转置3),表示已10为底的对数,参考log106、 使用题2和题3中所产生的向量和矩阵计算

4、以下等式,注意本题的操作均采用矩阵间的运算。1)2),注意这里与是不一样的3),这里为所对应行列式的值,参考det。7、 函数的使用和矩阵的访问。1) 计算矩阵cMat每一列的和,结果应为行向量形式。(参考sum)2) 计算eMat每一行的平均值,结果应为列向量形式。(参考mean)3) 用向量1 1 1 替换eMat的最上一行的值4) 将cMat的第29行,第2到9列的元素所构成的矩阵赋值给cSub。5) 使用函数rand产生一个1×5的向量r,并将r中值小于0.5的元素设置为0。(参考find)四、实验报告要求(包含预习报告要求和最终报告要求)最终报告要求预习报告要求 1.实验名

5、称 2.实验目的 3.实验设备及条件 4.实验内容及要求 5.实验程序设计 指程序代码。 6.实验结果及结果分析 实验结果要求必须客观,有数据的可以记录数据,没有数据的简单描述实验现象。结果分析是对实验结果的理论评判。 7.实验中出现的问题及解决方法 8. 思考题的回答四、 实验报告的提交方式Word文档,命名方式:实验号_你的学号_姓名;例如本次实验:实验一_000000001_张三.docE_mail: matlab_xx01下一次课前提交,过期不收!五、 参考文献参考教材和Matlab帮助文件。1. 实验名称 MATLAB基本操作及运算2. 实验目的 (1)理解Matlab数据对象的特点

6、; (2)掌握基本Matlab运算规则; (3)掌握Matlab帮助的使用方法;3. 实验设备及条件 计算机一台(带有MATLAB7.0以上的软件环境) 4. 实验内容及要求 要求建立一个名为experiment01.m的,把与实验内容1-7相关的实验命令都放入该文件中,题与题之间用相应注释分割。注意对实验中出现的相关函数或变量,请使用help或doc查询相关帮助文档,学习函数的用法。 5.实验程序设计 clcformat compactformat long g%1.1A=10%1.2b=2.5*1023%1.3c=2+3*i%1.4d=exp(j*2*pi)/3)%2.1aVec=3.14

7、 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*ones+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.6fMat=unifrnd(-2,5,4,3) %4.1x=1/(1+exp(-(A-15)/6)%4.2y=(sqrt(A)+b(1/21)pi%4.3z

8、=(log(real(c+d)*(c-d)*sin(A*pi/3)/(c*conj(c)%5.1xVec=exp(-cVec.2/2.252)/sqrt(2*pi*2.52)%5.2yVec1=sqrt(aVec').2/2+bVec.2)%5.3zVec=log10(1./dVec)%6.1xMat=(aVec*bVec)*aMat.2%6.2yMat=bVec*aVec%6.3zMat=det(cMat)*(aMat*bMat)'%7.1cMat_sum=sum(cMat,2)%7.2eMat_mean=mean(eMat,2)%7.3eMat_replace=eMat./

9、eMat(1,:);ones(1,3)%7.4cSub=cMat(cMat(2:9,:)%7.5fina=rand(5,1)fina1=find(fina<0.5)fina(fina1)=06. 实验结果及结果分析第一大题A = 10b = 2.5e+023c = 2 + 3id = -0.5 + 0.866025403784439i_第二大题aVec = Columns 1 through 2 3.14 15 Columns 3 through 4 9 26bVec = 2.71 8 28 182cVec = Columns 1 through 2 5 4.8 Columns 3 th

10、rough 4 4.6 4.4 Columns 5 through 6 4.2 4 Columns 7 through 8 3.8 3.6 Columns 9 through 10 3.4 3.2 Columns 11 through 12 3 2.8 Columns 13 through 14 2.6 2.4 Columns 15 through 16 2.2 2 Columns 17 through 18 1.8 1.6 Columns 19 through 20 1.4 1.2 Columns 21 through 22 1 0.8 Columns 23 through 24 0.6 0

11、.399999999999999 Columns 25 through 26 0.199999999999999 0 Columns 27 through 28 -0.199999999999999 -0.399999999999999 Columns 29 through 30 -0.6 -0.8 Columns 31 through 32 -1 -1.2 Columns 33 through 34 -1.4 -1.6 Columns 35 through 36 -1.8 -2 Columns 37 through 38 -2.2 -2.4 Columns 39 through 40 -2.

12、6 -2.8 Columns 41 through 42 -3 -3.2 Columns 43 through 44 -3.4 -3.6 Columns 45 through 46 -3.8 -4 Columns 47 through 48 -4.2 -4.4 Columns 49 through 50 -4.6 -4.8 Column 51 -5dVec = Columns 1 through 2 1 1.02353102189903 Columns 3 through 4 1.04761575278966 1.07226722201032 Columns 5 through 6 1.097

13、49876549306 1.12332403297803 Columns 7 through 8 1.14975699539774 1.176811952435 Columns 9 through 10 1.20450354025878 1.23284673944207 Columns 11 through 12 1.26185688306602 1.29154966501488 Columns 13 through 14 1.32194114846603 1.35304777457981 Columns 15 through 16 1.38488637139387 1.41747416292

14、681 Columns 17 through 18 1.45082877849594 1.48496826225447 Columns 19 through 20 1.51991108295293 1.55567614393047 Columns 21 through 22 1.59228279334109 1.62975083462064 Columns 23 through 24 1.66810053720006 1.70735264747069 Columns 25 through 26 1.74752840000768 1.78864952905743 Columns 27 throu

15、gh 28 1.83073828029537 1.87381742286038 Columns 29 through 30 1.91791026167249 1.96304065004027 Columns 31 through 32 2.00923300256505 2.05651230834865 Columns 33 through 34 2.10490414451202 2.15443469003188 Columns 35 through 36 2.20513073990305 2.25701971963392 Columns 37 through 38 2.310129700083

16、16 2.36448941264541 Columns 39 through 40 2.42012826479438 2.47707635599171 Columns 41 through 42 2.53536449397011 2.59502421139974 Columns 43 through 44 2.65608778294669 2.71858824273294 Columns 45 through 46 2.78255940220712 2.8480358684358 Columns 47 through 48 2.91505306282518 2.98364724028334 C

17、olumns 49 through 50 3.05385550883342 3.12571584968824 Columns 51 through 52 3.19926713779738 3.27454916287773 Columns 53 through 54 3.35160265093884 3.43046928631492 Columns 55 through 56 3.51119173421513 3.59381366380463 Columns 57 through 58 3.67837977182863 3.76493580679247 Columns 59 through 60

18、 3.85352859371053 3.94420605943766 Columns 61 through 62 4.03701725859655 4.13201240011534 Columns 63 through 64 4.2292428743895 4.32876128108306 Columns 65 through 66 4.43062145758388 4.53487850812858 Columns 67 through 68 4.64158883361278 4.7508101621028 Columns 69 through 70 4.86260158006535 4.97

19、702356433211 Columns 71 through 72 5.09413801481638 5.21400828799968 Columns 73 through 74 5.33669923120631 5.46227721768434 Columns 75 through 76 5.59081018251222 5.72236765935022 Columns 77 through 78 5.85702081805667 5.99484250318941 Columns 79 through 80 6.13590727341317 6.28029144183425 Columns

20、 81 through 82 6.42807311728432 6.57933224657568 Columns 83 through 84 6.73415065775082 6.8926121043497 Columns 85 through 86 7.05480231071864 7.22080901838546 Columns 87 through 88 7.39072203352578 7.56463327554629 Columns 89 through 90 7.74263682681127 7.92482898353917 Columns 91 through 92 8.1113

21、0830789687 8.30217568131975 Columns 93 through 94 8.49753435908644 8.69749002617784 Columns 95 through 96 8.90215085445039 9.11162756115489 Columns 97 through 98 9.3260334688322 9.54548456661834 Columns 99 through 100 9.77009957299225 10_第三大题aMat = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

22、 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2bMat = 1 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 1x = Columns 1 through

23、9 1 2 3 4 5 6 7 8 9 Columns 10 through 18 10 11 12 13 14 15 16 17 18 Columns 19 through 27 19 20 21 22 23 24 25 26 27 Columns 28 through 36 28 29 30 31 32 33 34 35 36 Columns 37 through 45 37 38 39 40 41 42 43 44 45 Columns 46 through 54 46 47 48 49 50 51 52 53 54 Columns 55 through 63 55 56 57 58 5

24、9 60 61 62 63 Columns 64 through 72 64 65 66 67 68 69 70 71 72 Columns 73 through 81 73 74 75 76 77 78 79 80 81 Columns 82 through 90 82 83 84 85 86 87 88 89 90 Columns 91 through 99 91 92 93 94 95 96 97 98 99 Column 100 100cMat = Columns 1 through 9 1 11 21 31 41 51 61 71 81 2 12 22 32 42 52 62 72

25、82 3 13 23 33 43 53 63 73 83 4 14 24 34 44 54 64 74 84 5 15 25 35 45 55 65 75 85 6 16 26 36 46 56 66 76 86 7 17 27 37 47 57 67 77 87 8 18 28 38 48 58 68 78 88 9 19 29 39 49 59 69 79 89 10 20 30 40 50 60 70 80 90 Column 10 91 92 93 94 95 96 97 98 99 100dMat = NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN N

26、aN NaNeMat = 13 -1 5 -22 10 -87fMat = Columns 1 through 2 4.65090499603023 4.23909276304231 -0.382030404979985 3.33467783119176 2.24789808479251 1.19527365617839 1.4018772809651 -1.87047449726243 Column 3 3.74985015006677 1.11292355047236 2.30802643670066 3.54355926198925_第四大题x = 0.302940716034593y

27、= 6269.60314420271z = 0.104633566196183_第五大题xVec = Columns 1 through 2 0.0011436837460341 0.00168440923977891 Columns 3 through 4 0.00244189145989572 0.00348451366324844 Columns 5 through 6 0.004894350444668 0.00676682628990691 Columns 7 through 8 0.00920899141861331 0.0123360517753163 Columns 9 thr

28、ough 10 0.0162658728660145 0.0211113321391906 Columns 11 through 12 0.026970622986521 0.033915903649967 Columns 13 through 14 0.0419810099474893 0.0511492707968797 Columns 15 through 16 0.061342728003881 0.0724142104534477 Columns 17 through 18 0.0841436968344532 0.096240185732909 Columns 19 through

29、 20 0.10834986912344 0.120070800079053 Columns 21 through 22 0.130973517949181 0.14062633423639 Columns 23 through 24 0.148623297923735 0.154612359137343 Columns 25 through 26 0.158321025606789 0.159576912160573 Columns 27 through 28 0.158321025606789 0.154612359137343 Columns 29 through 30 0.148623

30、297923735 0.14062633423639 Columns 31 through 32 0.130973517949181 0.120070800079053 Columns 33 through 34 0.10834986912344 0.096240185732909 Columns 35 through 36 0.0841436968344532 0.0724142104534477 Columns 37 through 38 0.061342728003881 0.0511492707968797 Columns 39 through 40 0.041981009947489

31、3 0.033915903649967 Columns 41 through 42 0.026970622986521 0.0211113321391906 Columns 43 through 44 0.0162658728660145 0.0123360517753163 Columns 45 through 46 0.00920899141861331 0.00676682628990691 Columns 47 through 48 0.004894350444668 0.00348451366324844 Columns 49 through 50 0.002441891459895

32、72 0.00168440923977891 Column 51 0.0011436837460341yVec1 = 3.50341262200158 13.2853302555864 28.7141080307225 182.926214633114zVec = Columns 1 through 2 0 -0.0101010101010101 Columns 3 through 4 -0.0202020202020202 -0.0303030303030304 Columns 5 through 6 -0.0404040404040404 -0.0505050505050505 Colum

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

34、mns 17 through 18 -0.161616161616162 -0.171717171717172 Columns 19 through 20 -0.181818181818182 -0.191919191919192 Columns 21 through 22 -0.202020202020202 -0.212121212121212 Columns 23 through 24 -0.222222222222222 -0.232323232323232 Columns 25 through 26 -0.242424242424242 -0.252525252525253 Colu

35、mns 27 through 28 -0.262626262626263 -0.272727272727273 Columns 29 through 30 -0.282828282828283 -0.292929292929293 Columns 31 through 32 -0.303030303030303 -0.313131313131313 Columns 33 through 34 -0.323232323232323 -0.333333333333333 Columns 35 through 36 -0.343434343434343 -0.353535353535354 Colu

36、mns 37 through 38 -0.363636363636364 -0.373737373737374 Columns 39 through 40 -0.383838383838384 -0.393939393939394 Columns 41 through 42 -0.404040404040404 -0.414141414141414 Columns 43 through 44 -0.424242424242424 -0.434343434343434 Columns 45 through 46 -0.444444444444444 -0.454545454545455 Colu

37、mns 47 through 48 -0.464646464646465 -0.474747474747475 Columns 49 through 50 -0.484848484848485 -0.494949494949495 Columns 51 through 52 -0.505050505050505 -0.515151515151515 Columns 53 through 54 -0.525252525252525 -0.535353535353535 Columns 55 through 56 -0.545454545454545 -0.555555555555556 Colu

38、mns 57 through 58 -0.565656565656566 -0.575757575757576 Columns 59 through 60 -0.585858585858586 -0.595959595959596 Columns 61 through 62 -0.606060606060606 -0.616161616161616 Columns 63 through 64 -0.626262626262626 -0.636363636363636 Columns 65 through 66 -0.646464646464647 -0.656565656565657 Columns 67 through 68 -0.666666666666667 -0.6767

温馨提示

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

评论

0/150

提交评论