您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 薪酬管理 > malterlab作业题汇总
习题一2.输入A=[715;256;315],B=[111;222;333],在命令窗口中执行下列表达式,掌握其含义:A(2,3)ans=6A(:,2)ans=151A(3,:)ans=315A(:,1:2:3)ans=752635A(:,3).*B(:,2)ans=51215A(:,3)*B(2,:)ans=101010121212101010A*Bans=242424303030202020A.*Bans=715410129315A^2ans=661766423370381346A.^2ans=49125425369125B/Aans=0.18420.2105-0.23680.36840.4211-0.47370.55260.6316-0.7105B./Aans=0.14291.00000.20001.00000.40000.33331.00003.00000.60003.输入C=1:2:20,则C(i)表示什么?其中i=1,2,3,…,10;C=1:2:20C=135791113151719C(1)ans=1C(2)ans=3C(5)ans=9C(10)ans=194.查找已创建变量的信息,删除无用的变量whosANameSizeBytesClassA3x372doublearrayGrandtotalis9elementsusing72byteswhosCNameSizeBytesClassC1x1080doublearrayGrandtotalis10elementsusing80bytesclearAA???Undefinedfunctionorvariable'A'.5.创建如下变量:在0-3均匀的产生10个点值,形成10维向量3*3阶单位距阵,随机距阵,魔方距阵,全0距阵,全1距阵,生成以向量V=[1,2,3,4]为基础向量的范得蒙矩阵生成3阶的希尔伯特矩阵linspace(0,3,10)ans=00.33330.66671.00001.33331.66672.00002.33332.66673.0000E=ones(3,3)E=111111111randn(3,3)ans=-0.43260.28771.1892-1.6656-1.1465-0.03760.12531.19090.3273magic(3)ans=816357492eye(3,3)ans=100010001zeros(3,3)ans=000000000E=ones(3,3)E=111111111randn(3,3)ans=-0.43260.28771.1892-1.6656-1.1465-0.03760.12531.19090.3273E=111111111ans=1111842127931641641ans=9-3630-36192-18030-1801806.(1)求方程组1x5x0x6x5x0x6x5x0x6x5x1x6x55454343232121的解R=[56000;15600;01560;00156;00015],T=[1;0;0;0;1]R=5600015600015600015600015T=10001R\Tans=2.2662-1.72181.0571-0.59400.3188第八题ans=[x*exp(x),log(sin(x))][1/(1+x^2),x^(3/2)]第九题(1)y=-2.09461.0473+1.1359i1.0473-1.1359i(2)x=-4-1(3)p=113(4)x1=.61375389080390682789737879102986x2=-.68619276878228013395848197030388第十题ans=exp(-t)*sin(t)ans=C1*exp(-t)*sin(t)+C2*exp(-t)*cos(t)习题二1.编写程序,计算1+3+5+7+…+(2n+1)的值(用input语句输入n值)。解:程序:sum=0;n=input('Pleaseinputanumber:');t=2*n+1;fori=1:2:tsum=sum+i;enddisp(sum)结果:Pleaseinputanumber:4252.习题4-1程序:x1=0:0.1:20;x2=-5:0.1:5;y1=sqrt(x1);y2=sin(x2);subplot(1,2,1)plot(x1,y1,'.-r');subplot(1,2,2)plot(x2,y2,'g');结果:0510152000.511.522.533.544.5-505-1-0.8-0.6-0.4-0.200.20.40.60.814-2.使用for函数编写一个程序实现sum(A)的功能,其中A为矩阵。解:1.程序:s=0;m=input('Pleaseinputanumber:');n=input('Pleaseinputanumber:');A=ones(m,n)fori=1:mforj=1:ns=s+A(i,j);endenddisp(s)2.结果Pleaseinputanumber:2Pleaseinputanumber:3A=11111164-3.编写一个函数文件,用于生成等比数列。1.程序:q=1n=input('Pleaseinputanumbern:');m=input('Pleaseinputanumberm:');forj=1:(m-1)q=q*n;enddisp(q)结果:Pleaseinputanumbern:2Pleaseinputanumberm:5164-7设,2/,3/,0),2sin(,)cos(tytx在四个子图中分别画出其曲线,并给出图例。程序:symstt=0:pi/65:pi;x=cos(t);subplot(2,2,1)plot(x,sin(2*t+0));title('a=0')subplot(2,2,2)plot(x,sin(2*t+pi/3));title('a=pi/3')subplot(2,2,3)plot(x,sin(2*t+pi/2));title('a=pi/2')subplot(2,2,4)plot(x,sin(2*t+pi));title('a=pi')结果:4-8.绘制函数22,/)sin(yxrrrz的三维曲面图.程序[x,y]=meshgrid(-4*pi:0.1*pi:4*pi);r=sqrt(x.^2+y.^2);z=sin(r)./(r+eps);surf(x,y,z);结果-20-1001020-20-1001020-0.500.51。4-9程序x=0:0.01:2y1=sin(x);y2=0.5*exp(x);plot(x,y1,'-.r',x,y2,'g')legend('y=sin(x)','y2=0.5*exp(x)')xlabel('x');ylabel('y');结果00.20.40.60.811.21.41.61.8200.511.522.533.54xyy=sin(x)y2=0.5*exp(x)习题三1.1在MATLAB命令窗口输入funtool,在弹出的figureNo.3产生以下信号波形:3sin(x),5exp(-x),sin(x)/x,1-2abs(x)/a,sqrt(a*x)(a=2)1.2产生50hz的正弦波的程序t=0:0.001:50;y=sin(2*pi*50*t);plot(t(1:50),y(1:50))title('sin')00.0050.010.0150.020.0250.030.0350.040.0450.05-1-0.8-0.6-0.4-0.200.20.40.60.81sin1.3产生加入随机噪声的正弦波:t=0:0001:50;y=sin(2*pi*50*t);s=y+randn(size(t));plot(t(1:50),s(1:50))05101520253035404550-2.5-2-1.5-1-0.500.511.522.51.4产生周期方波的的程序:(f=30hz)t=0:.0001:.0625;y=SQUARE(2*pi*30*t);plot(t,y)00.010.020.030.040.050.060.07-1-0.8-0.6-0.4-0.200.20.40.60.811.5产生周期锯齿波t=0:0.001:0.25;y=sawtooth(2*pi*30*t);plot(t,y)axis([00.2-11])00.020.040.060.080.10.120.140.160.180.2-1-0.8-0.6-0.4-0.200.20.40.60.812.试用MATALB绘制两正弦序列12()cos(/8),()cos(2)fkkfkk的时域波形,观察它们的周期性,并验证是否与理论分析结果相符。(提示:并非所有的离散时间正弦序列信号都是周期的,不同于连续时间正弦信号)0510152025-1-0.500.51f1=cos(k*pi/8)0510152025-1-0.500.51f2=cos(2*k)3.完成)(1tf与)(2tf两函数的卷积运算其中:)4()()(),()(221tututftuetft在一个图形窗口中,画出)(1tf、)(2tf以及卷积结果。024600.51tf1(t)f1(t)024600.51tf2(t)f2(t)01234567891000.20.40.60.8tf(t)f(t)=f1(t)*f2(t)4.已知描述某连续系统的微分方程为:2''()'()8()()ytytytft,试用MATLAB:(1)绘出该系统在0~30s范围内,并以时间间隔0.01s取样的冲激响应和阶跃响应的时域波形;(2)求出系统在0~30s范围内,并以时间间隔0.01s取样的冲激响应和阶跃响应的数值解。051015202530-0.200.20.40.6ImpulseResponseTime(sec)Amplitude05101520253000.10.20.30.4StepResponseTime(sec)Amplitudeh=2/21*exp(-1/4*t)*sin(3/4*7^(1/2)*t)*7^(1/2)*(-1+heaviside(t))g=-1/168*heaviside(t)*(-21+exp(-1/4*t)*sin(3/4*7^(1/2)*t)*7^(1/2)+21*exp(-1/4*t)*cos(3/4*7^(1/2)*t))5.已知某一连续时间信号为2()tfte,试绘出它的时域波形响应的频谱图。-40-30-20-1001020304000.10.20.30.40.50.60.70.80.91wF(jw)频谱F(jw)6.绘制系统函数的零极点图;绘制系统的幅频特性和相频特性;求单位冲激响应h(t)并画图;用laplace逆变换求h(t)表达式,并分析系统的稳定性。H(s)=(s^2+s)/(2s^2+6s+4)-2-1.8-1.6-1.4-1.2-1-0.8-0.6-0.4-0.20-1-0.8-0.6-0.4-0.200.20.40.60.81Pole-ZeroMapRealAxisImaginaryAxis10-210-1100101020406080100Frequency(rad/s)Phase(degrees)10-210-110010110-310-210-1100Frequency(rad/s)Magnitude-6-5-4-3-2-1012-6-5-4-3-2-10x104t1/2dirac(t)-exp(-2t)f=1/2*dirac(t)-exp(-2*t)7.习题6-9要求同习
本文标题:malterlab作业题汇总
链接地址:https://www.777doc.com/doc-3354355 .html