实验4:多项式与字符操作

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

数学实验四目的:了解多项式的各种运算理解多维数组的生成与操作理解字符与字符串的存储与操作1、求多项式0423xx的根(使用roots命令)A=[10-2-4]A=10-2-4roots(A)ans=2.0000-1.0000+1.0000i-1.0000-1.0000i2、设矩阵43211093657.159.0532.1Aa)求A的特征多项式P(x)P=poly(A)P=1.0000-6.9000-77.2600-86.1300604.5500b)求P(x)的导dp=polyder(P)dp=4.0000-20.7000-154.5200-86.1300c)求P(20)的值PA=polyval(P,20)PA=7.2778e+004d)求P(A)的矩阵运算的结果和数组运算的结果PA=polyval(P,A)PA=1.0e+003*0.3801-0.4545-1.99510.4601-1.99510.2093-1.9951-2.8880-0.4545-4.89780.60460.43530.43530.0841-0.4545-1.1617PM=polyvalm(P,A)PM=1.0e-011*0.1364-0.33500.00800.1421-0.0455-0.0114-0.1627-0.0909-0.30840.1705-0.0227-0.22170.0171-0.1265-0.03270.02273、设a(s)=s2+2s+3和b(s)=s5+5s4+3s2+1a)求a(s)和b(s)的乘积b)求b(s)/a(s)的商与余项a=[123]a=123b=[150301]b=150301P=conv(a,b)P=17131861023[q,r]=deconv(a,b)q=0r=1234、设有五个数据点:(1,5.5),(2,43.1),(3,128),(4,290.7),(5,498.4)。a)作出这五个数据点的三次拟合多项式;X=[12345],Y=[5.543.1128290.7498.4]X=12345Y=Columns1through45.500043.1000128.0000290.7000Column5498.4000pf=polyfit(X,Y,3)pf=-0.191731.5821-60.326235.3400b)试打印出该拟合多项式的图形,并将数据点在图形上用“o”标注出来。11.522.533.544.55050100150200250300350400450500c)使用帮助查寻插值命令interp1的用法,打印出上5个点的插值函数图像并与拟合函数比较。5、生成一334的3三维数组D,要求:a)第一页的元素为A=[578;019;436],第二页为A的转置阵,第三页为A旋转90o的矩阵,第四页为A上下元素颠倒的矩阵;b)使用cat命令生成上述矩阵;c)取出第一行所有列与所有页的元素;d)使用reshape将上面的高位数组重排为343的矩阵h,并取出其第二页h2。作一新的4维数组,h为第一箱,h2为第二箱的第三页元素;e)查寻repmat命令的用法;6、对下列短文做一下操作:a)统计下列短文中的空格数、小写字母数、非英文字符数。s='BorninLondonin1959,hewaseducatedatEton,OxfordandCaltech.Hepublishedhisfirstscientificpaperattheageoffifteen,andhadreceivedhisPhDintheoreticalphysicsfromCaltechbytheageoftwenty.Wolfram''searlyscientificworkwasmainlyinhighenergyphysics,quantumfieldtheoryandcosmology,andincludedseveralnowclassicresults.Havingstartedtousecomputersin1973,Wolframrapidlybecamealeaderintheemergingfieldofscientificcomputing,andin1979hebegantheconstructionofSMP-thefirstmoderncomputeralgebrasystem-whichhereleasedcommerciallyin1981.Throughthemid1980s,Wolframcontinuedhisworkoncomplexity,discoveringanumberoffundamentalconnectionsbetweencomputationandnature,andinventingsuchconceptsascomputationalirreducibility.Wolfram''sworkledtoawiderangeofapplications-andprovidedthemainscientificfoundationsforthepopularmovementsknownascomplextytheoryandartificiallife.Wolframhimselfusedhisideastodevelopanewrandomnessgenerationsystemandanewapproachtocomputationalfluiddynamics-bothofwhicharenowinwidespreaduse.'su1=sum(s='a'&s='z')su1=911su2=sum('s=32')su2=309m=length(s)m=1149su2=sum(s='A'&s='Z')su2=19su3=m-su1-su2su3=219

1 / 4
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功