第1章
一、思考题
4. (1) B=A(2:5,1:2:5)
(2)A(7)=[]
(3) A=A+30
(4)size(A)
(5) t(find(t==0))=eps
(6)t=reshape(x,3,4)
(7)abs('matlab')
(8)char(93)
5. A=[97,67,34,10;-78,75,65,5;32,5,-23,-59;0,-12,54,7]
(1) B=A(1:3,:)
C=A(:,1:2)
D=A(2:4,3:4)
E=B*C
(2)A(find(A>=50 & A<=100))
二、实验题
1.x=-74/180*pi;y=-27/180*pi;
sin(x*x+y*y)/sqrt(tan(abs(x+y)))+pi
2.a=-3.0:0.1:3.0;
exp(-0.3*a).*sin(a+0.3)
3.x=[2,4;-0.45,5];
log(x+sqrt(1+x.*x))/2
4. A=[3,54,2;34,-45,7;87,90,15];B=[1,-2,67;2,8,74;9,3,0];
(1)A*B
ans =
129 432 4197
7 -407 -1052
402 591 12489
A.*B
ans =
3 -108 134
68 -360 518
783 270 0
(2) A^3
ans =
-28917 240246 -4368
137883 -259101 27669
171333 252504 38673
A.^3
ans =
27 157464 8
39304 -91125 343
658503 729000 3375
(3)A/B
ans =
-5.8845 5.3549 -0.2028
6.3554 -5.6596 4.3293
-6.6325 6.2078 9.0241
B/A
ans =
30.2855 19.2643 -8.5614