1、Matlab与通信仿真 1 1.在 Command Window里面计算 ( 1) (3 5 8) 5 10 ; (3+5+8)/5*10 ans=32 ( 2) sin(3 ) 9 / 5 ; sin(3*pi)/sqrt(9/5) ans=2.7384e-16 ( 3) 1 2 34567 8 9A, 7 8 94561 2 3B,计算: , , , /C A B D A B A C C B ; a=1 2 3;4 5 6;7 8 9; b=7 8 9;4 5 6;1 2 3; c=a*b c = 18 24 30 54 69 84 90 114 138 d=a+b d = 8 10 12
2、 8 10 12 8 10 12 e=ac Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.541976e-018. e = 34.0000 22.0000 62.0000 Matlab与通信仿真 2 -50.0000 -23.0000 -100.0000 28.0000 16.0000 56.0000 f=c/b Warning: Matrix is singular to working precision. f = NaN NaN NaN NaN -Inf
3、 Inf NaN NaN NaN ( 4) 3 1 .2 47 .5 6 .6 3 .15 .4 3 .4 6 .1A,求 1,A A A ; (求矩阵的 行列式 ) a=3 1.2 4;7.5 6.6 3.1;5.4 3.4 6.1; a ans = 3.0000 7.5000 5.4000 1.2000 6.6000 3.4000 4.0000 3.1000 6.1000 inv( c) c = 2.1555 0.4555 -1.6449 -2.1040 -0.2393 1.5013 -0.7354 -0.2698 0.7833 det(a) ans = 13.7880 Matlab与通信
4、仿真 3 ( 5) 1 2 3 45 6 7 8iiZ ,输入复数矩阵; z=1+2*i 3+4*i;5+6*i 7+8*i orz=1 3;5 7+2 4;6 8i z = 1.0000 + 2.0000i 3.0000 + 4.0000i 5.0000 + 6.0000i 7.0000 + 8.0000i 2.建立 .m文件,用 for循环语句生成 55的矩阵 A:1 2 52 3 65 6 9,将 A矩阵进行水平和垂直翻转得到矩阵 B和 C。将 A 矩阵的前 3行, 3 列变成 0 并赋值给 D。 a=zeros(5); for m=1:5 for n=1:5 a(m,n)=m+n-1
5、end end a = 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 a = 1 2 0 0 0 Matlab与通信仿真 4 0 0 0 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