Matlab上机练习二答案剖析

1、 求x???4?8i3?5i2?7i1?4i7?5i??的共轭转置。 3?2i7?6i9?4i3?9i4?4i??>> x=[4+8i 3+5i 2-7i 1+4i 7-5i;3+2i 7-6i 9+4i 3-9i 4+4i];

>> x’ ans =

4.0000 - 8.0000i 3.0000 - 2.0000i 3.0000 - 5.0000i 7.0000 + 6.0000i 2.0000 + 7.0000i 9.0000 - 4.0000i 1.0000 - 4.0000i 3.0000 + 9.0000i 7.0000 + 5.0000i 4.0000 - 4.0000i 2、计算a???693??241?b?与??468?的数组乘积。

?275???>> a=[6 9 3;2 7 5];

>> b=[2 4 1;4 6 8]; >> a.*b ans =

12 36 3 8 42 40 3、

?492??37????26对于AX?B,如果A??764?,B???????357???28??,求解X。

>> A=[4 9 2;7 6 4;3 5 7];

>> B=[37 26 28]’; >> X=A\\B X =

-0.5118 4.0427 1.3318

4、 a???,b??336?4???>> a=[1 2 3;4 5 6]; >> b=[8 –7 4;3 6 2]; >> a>b ans =

0 1 0 1 0 1 >> a>=b ans =

0 1 0 1 0 1 >> a

1 0 1 0 1 0 >> a<=b

?125??8?74?,观察62??a与b之间的六种关系运算的结果。

ans =

1 0 1 0 1 0 >> a==b ans =

0 0 0 0 0 0 >> a~=b ans =

1 1 1 1 1 1

5、a??50.20?8?0.7?,在进行逻辑运算时,a相当于什么样的逻辑量。 相当于a=[1 1 0 1 1]。

6、 角度x??304560?,求x的正弦、余弦、正切和余切。

>> x=[30 45 60]; >> x1=x/180*pi; >> sin(x1) ans =

0.5000 0.7071 0.8660 >> cos(x1) ans =

0.8660 0.7071 0.5000 >> tan(x1) ans =

0.5774 1.0000 1.7321 >> cot(x1) ans =

1.7321 1.0000 0.5774

7、 用四舍五入的方法将数组[2.4568 6.3982 3.9375 8.5042]取整。 >> b=[2.4568 6.3982 3.9375 8.5042]; >> round(b) ans =

2 6 4 9

4813??1?543?2??,B??6?23?8?,求C1=A*B’;C2=A’*B;C3=A.*B,并求上述?36?5?98、设A?????????13?97????2?7?12?8??所有方阵的逆阵。

>> A=[1 4 8 13;-3 6 -5 -9;2 -7 -12 -8]; >> B=[5 4 3 -2;6 -2 3 -8;-1 3 -9 7]; >> C1=A*B' C1 =

19 -82 30

12 27 3 -38 54 29 >> C2=A'*B C2 =

-15 16 -24 36 63 -17 93 -105 22 6 117 -60 19 46 84 -10 >> C3=A.*B C3 =

5 16 24 -26 -18 -12 -15 72 -2 -21 108 -56 >> inv(C1) ans =

0.0062 0.0400 -0.0106 -0.0046 0.0169 0.0030 0.0168 0.0209 0.0150 >> inv(C2)

Warning: Matrix is close to singular or badly scaled.

Results may be inaccurate. RCOND = 8.997019e-019.

ans =

1.0e+015 *

-0.9553 -0.2391 -0.1997 0.2700 0.9667 0.2420 0.2021 -0.2732 -0.4473 -0.1120 -0.0935 0.1264 -1.1259 -0.2818 -0.2353 0.3182 >> inv(C3)

??? Error using ==> inv Matrix must be square.

9、设x=rcost+3t,y=rsint+3,分别令r=2,3,4,画出参数t=0~10区间生成的x~y曲线。 >> t=linspace(0,10); >> r1=2;

>> x1=(r1*cos(t)+3*t); >> y1=r1*sin(t)+3; >> r2=3;

>> x2=(r2*cos(t)+3*t); >> y2=r2*sin(t)+3; >> r3=4;

>> x3=(r3*cos(t)+3*t); >> y3=r3*sin(t)+3;

>> plot(x1,y1,'r',x2,y2,'b',x3,y3,'m')

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4