资源描述:
《东南大学信号与系统MATLAB实践第一次作业》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、....<信号与系统MATLAB实践>练习一实验一二.熟悉简单的矩阵输入1.实验代码>>A=[1,2,3;4,5,6;7,8,9]实验结果A=1234567893.实验代码>>B=[9,8,7;6,5,4;3,2,1]C=[4,5,6;7,8,9;1,2,3]实验结果:B=987654321C=4567891234.>>AA=123456789>>BB=987654321专业资料....>>CC=456789123三.基本序列运算1.>>A=[1,2,3],B=[4,5,6]A=123B=456>>C=A+BC=579>>
2、D=A-BD=-3-3-3>>E=A.*BE=41018>>F=A./BF=0.25000.40000.5000>>G=A.^B专业资料....G=132729>>stem(A)>>stem(B)专业资料....>>stem(C)>>stem(D)专业资料....>>stem(E)>>stem(F)专业资料....>>stem(G)再举例:>>a=[-1,-2,-3]a=专业资料....-1-2-3>>b=[-4,-5,-6]b=-4-5-6>>c=a+bc=-5-7-9>>d=a-bd=333>>e=a.*be=4101
3、8>>f=a./bf=0.25000.40000.5000>>g=a.^bg=1.0000-0.03130.0014>>stem(a)专业资料....>>stem(b)>>stem(c)专业资料....>>stem(d)>>stem(e)专业资料....>>stem(f)>>stem(g)专业资料....2.>>t=0:0.001:10f=5*exp(-t)+3*exp(-2*t);plot(t,f)ylabel('f(t)');xlabel('t');title('(1)');专业资料....>>t=0:0.001:3;
4、f=(sin(3*t))./(3*t);plot(t,f)ylabel('f(t)');xlabel('t');title('(2)');专业资料....>>k=0:1:4;f=exp(k);stem(f)专业资料....四.利用MATLAB求解线性方程组2.>>A=[1,1,1;1,-2,1;1,2,3]b=[2;-1;-1]x=inv(A)*bA=1111-21123b=2-1-1x=3.00001.0000-2.00004.>>A=[2,3,-1;3,-2,1;1,2,1]b=[18;8;24]x=inv(A)*bA
5、=23-13-21121b=18824x=专业资料....468实验二二.1.>>k=0:50x=sin(k);stem(x)xlabel('k');ylabel('sinX');title('sin(k)ε(k)');2.>>k=-25:1:25x=sin(k)+sin(pi*k);stem(k,x)xlabel('k');ylabel('f(k)');title('sink+sinπk');专业资料....3.>>k=3:50x=k.*sin(k);stem(k,x)xlabel('k');ylabel('f(k)')
6、;title('ksinkε(k-3)');4.%函数functiony=f1(k)ifk<0y=(-1)^k;elsey=(-1)^k+(0.5)^k;end%运行代码fork=-10:1:10;y4(k+11)=f1(k);end专业资料....k=-10:1:10;stem(k,y4);xlabel('k');ylabel('f(k)');title('4');七.2.>>f1=[1111];f2=[321];conv(f1,f2)ans=3566313.函数定义:function[r]=pulse(k)ifk<0r
7、=0;elser=1;endend运行代码fork=1:10f1(k)=pulse(k);f2(k)=(0.5^k)*pulse(k);endconv(f1,f2)结果ans=专业资料....Columns1through100.50000.75000.87500.93750.96880.98440.99220.99610.99800.9990Columns11through200.99950.99980.99990.99991.00001.00001.00001.00001.00001.0000Columns21thro
8、ugh300.50000.25000.12500.06250.03120.01560.00780.00390.00200.0010Columns31through390.00050.00020.00010.00010.00000.00000.00000.00000.00004fori=1:10f1(i)