您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > 《MATLAB及应用》实验指导书作业答案
湖北汽车工业学院毕业论文I《MATLAB及应用》实验指导书班级:姓名:学号:总评成绩:汽车工程系电测与汽车数字应用中心湖北汽车工业学院毕业论文II目录实验04051001MATLAB语言基础.....................................................................................3实验04051002MATLAB科学计算及绘图........................................................................12湖北汽车工业学院毕业论文3实验04051001MATLAB语言基础实验目的1)熟悉MATLAB的运行环境2)掌握MATLAB的矩阵和数组的运算3)掌握MATLAB符号表达式的创建4)熟悉符号方程的求解实验内容(任选6题)1.利用rand等函数产生下列矩阵:产生一个均匀分布在(-5,5)之间的随机阵(50×2),要求显示精度为精确到小数点后一位(精度控制指令为format)。formatbanka=-5;b=5;r=a+(b-a).*rand(50,2)r=3.15-2.244.061.80-3.731.554.13-3.371.32-3.81-4.02-0.02-2.224.600.47-1.604.580.854.65-2.76-3.422.514.71-2.454.570.06-0.151.993.003.91-3.584.59-0.780.474.16-3.612.92-3.514.59-2.421.563.41-4.64-2.463.493.144.34-2.56操作成绩报告成绩湖北汽车工业学院毕业论文41.794.292.58-1.502.43-3.03-1.08-2.491.551.16-3.29-0.272.06-1.48-4.683.31-2.230.85-4.540.50-4.034.173.23-2.141.952.57-1.832.544.50-1.20-4.660.68-0.61-4.24-1.18-4.462.660.312.952.79-3.134.34-0.10-3.70-0.540.691.46-0.312.09-4.882.55-1.632.在一个已知的测量矩阵T(100×100)中,删除整行数据全为0的行,删除整列数据全为0的列(判断某列元素是否为0方法:检查T(:,i).*(T(:,i))是否为0)。T=rand(10,10);T(3,:)=0;T(:,4)=0;[row,col]=size(T);r=[];c=[];fori=row:-1:1if(sum(T(i,:).*T(i,:))==0)r(size(r)+1)=i;endendif(size(r))T(r,:)=[];end[row,col]=size(T);湖北汽车工业学院毕业论文5forj=col:-1:1if(sum(T(:,j).*T(:,j))==0)c(size(c)+1)=j;endendif(size(c))T(:,c)=[]endT=Columns1through40.830.870.140.490.540.080.870.340.080.260.550.370.440.800.140.110.110.430.850.780.960.910.620.390.000.180.350.240.770.260.510.400.820.150.400.10Columns5through80.130.170.180.310.940.650.370.510.580.650.780.820.060.450.080.790.230.550.930.640.350.300.780.380.820.740.490.810.020.190.440.530.040.690.450.35Column90.940.880.620.590.210.300.470.230.843.假设汽车系在下列各年度的人口统计如表所示年份类别大一新生学士毕业生湖北汽车工业学院毕业论文62002102822003120100200498942005105972006121110试用一个二维矩阵STU表示上述数据,并请计算出下列各数值:(1)汽车系在2002~2006年之间的每年平均新生、毕业生人数。(2)5年来汽车系共有多少毕业生?(3)在哪几年,新生数目比毕业生多?(4)5年来每年的毕业生对新生的比例平均值为何?STU=[2002102822003120100200498942005105972006121110];Ave_Stu=round(mean(STU(:,[2,3])))Sum_gra=sum(STU(:,3))Ave_Stu=10997Sum_gra=483STU_radio=mean(STU(:,3)./STU(:,2))STU_radio=0.88594.完成下列矩阵运算:(1)使用randn产生一个(10×10)的矩阵A(2)计算B=(A+A’)/2。请注意,B一定是一个对称矩阵(3)计算矩阵B的特征向量e1e2…e10(使用函数eig)(4)验证在i不等于j的情况下,ei和ej的内积必定为0A=randn(10,10)B=(A+A')/2C=eig(B)A=Columns1through60.5377-1.34990.67150.8884-0.1022-0.86371.83393.0349-1.2075-1.1471-0.24140.0774-2.25880.72540.7172-1.06890.3192-1.2141湖北汽车工业学院毕业论文70.8622-0.06311.6302-0.80950.3129-1.11350.31880.71470.4889-2.9443-0.8649-0.0068-1.3077-0.20501.03471.4384-0.03011.5326-0.4336-0.12410.72690.3252-0.1649-0.76970.34261.4897-0.3034-0.75490.62770.37143.57841.40900.29391.37031.0933-0.22562.76941.4172-0.7873-1.71151.10931.1174Columns7through10-1.0891-0.61561.4193-1.14800.03260.74810.29160.10490.5525-0.19240.19780.72231.10060.88861.58772.58551.5442-0.7648-0.8045-0.66690.0859-1.40230.69660.1873-1.4916-1.42240.8351-0.0825-0.74230.4882-0.2437-1.9330-1.0616-0.17740.2157-0.43902.3505-0.1961-1.1658-1.7947B=Columns1through60.53770.2420-0.79370.87530.1083-1.08570.24203.0349-0.2410-0.60510.2366-0.0638-0.7937-0.24100.71720.28070.4041-0.08970.8753-0.60510.2807-0.8095-1.31570.16240.10830.23660.4041-1.3157-0.8649-0.0185-1.0857-0.0638-0.08970.1624-0.01851.5326-0.7613-0.04580.63970.71290.6897-0.3419-0.13651.1189-0.24790.0668-0.0686-0.51542.49890.85030.24581.47900.14440.23550.81070.7610-0.03250.43700.22120.6523Columns7through10-0.7613-0.13652.49890.8107-0.04581.11890.85030.76100.6397-0.24790.2458-0.03250.71290.06681.47900.43700.6897-0.06860.14440.2212-0.3419-0.51540.23550.6523-1.4916-1.0823-0.11321.1340-1.08230.4882-0.2105-1.0645-0.1132-0.21050.2157-0.80241.1340-1.0645-0.8024-1.7947C=-4.0702-3.4514湖北汽车工业学院毕业论文8-1.5577-1.2496-0.03430.84961.48752.15493.24864.18825.下列MATLAB语句用于画出函数x0.2e2)y(x在[0,10]的值。x=0:0.1:10;y=2*exp(-0.2*x);plot(x,y);利用MATLAB的M-文件编辑器创建一个新的M-文件,输入上述代码,保存为文件test1.m。然后在命令窗口中输入test1执行这个文件。看得到什么结果?x=0:0.1:10;y=2*exp(-0.2*x);plot(x,y);0123456789100.20.40.60.811.21.41.61.826.熟悉MATALB帮助的使用:1)通过以下两种方式得到关于exp函数的帮助(a)在命令窗口中输入helpexp命令;(b)运用帮助空间窗口。2)使用lookfor命令查找出以10为底的对数函数,并计算1、10、1000的对数值。helpexp湖北汽车工业学院毕业论文9EXPExponential.EXP(X)istheexponentialoftheelementsofX,etotheX.ForcomplexZ=X+i*Y,EXP(Z)=EXP(X)*(COS(Y)+i*SIN(Y)).SeealsoEXPM1,LOG,LOG10,EXPM,EXPINT.Overloadedmethods:lti/expcodistributed/expReferencepageinHelpbrowserdocexplookforlog10log10-Common(base10)logarithm.LOG10Common(base10)logarithm.LOG10(X)isthebase10logarithmoftheelementsofX.ComplexresultsareproducedifXisnotpositive.ClasssupportforinputX:float:double,singleSeealsolog,log2,exp,logm.Overloadedmethods:codistributed/log10ReferencepageinHelpbrowserdoclog10log10(1)log10(10)log10(1000)ans=0ans=1ans=37.假设u=1和v=3,用MATLAB符号计算功能计算下列表达式的值:湖北汽车工业学院毕业论文10a.3v4ub.)vu/(2v2c.)uv/(v333d.3/v42u=1;v=3;a=4*u/(3*v)b=2*v^(-2)/(u+v)c=v^3/(v^3-u^3)d=4*pi*v^2/3a=0.4444b=0.0556c=1.0385d=37.69918.a=3,A=4,b=a2,B=b2-1,c=a+A-2B,C=a+B+2c,求C。(使用符号函数solve)S=solve('a-3','A-4','b-a^2','B-b^2+1','c-a-A+2*B','C-a-B-2*c');C=S.CC=-2239.求解常微分方程x’’=-x’+x+1,x’(0)=1,x(0)=0(使用符号函数dsolve)S=dsolve('D2x=-Dx+x+1','D
本文标题:《MATLAB及应用》实验指导书作业答案
链接地址:https://www.777doc.com/doc-2864816 .html