NO.7
>> A=[1,4,8,13;-3,6,-5,-9;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] B =
5 4 3 -2 6 -2 3 -8 -1 3 -9 7
>> C=A*B' C =
19 -82 30 12 27 3 -38 54 29
>> D=A.*B D =
5 16 24 -26 -18 -12 -15 72 -2 -21 108 -56 >> NO.8
>> den=conv([1,0,2],conv([1,4],[1,2]))
den =
1 6 10 12 16 num=[1,0,1,1];
>> [q,r]=deconv(den,num) q =
1 6 r =
0 0 9 5 10 >> NO.9
>> A=[10,15,8;5,16,35;16,8,26] A =
10 15 8 5 16 35 16 8 26
>> (A>=10)&(A<=20)
ans =
1 1 0 0 1 0 1 0 0 >> NO.10 x =
1 2 3 4
>> x(1)
ans =1
>> x(3)
ans =3
>> x(5)
ans = 5
5 6 7 >> x(4:end)
ans = 4 5 6 7 >> x(x>70)
ans =
Empty matrix: 1-by-0 >>
实验二
?3sinx??,把x?0~2?区间分为125点,画出以x为横坐1. 设y?cosx?0.5?2??1?x????标,y为纵坐标的曲线。 2. 设x?zsin3z,y?zcos3z,要求在z??45~45区间内画出x,y,z三维曲线。 3. 设z?xe222?x?y??,求定义域x?[?2,2],y?[?2,2]内的z值(网格取0.1见方)
,
并绘制三维曲面。
4. 设z1?0.05x?0.05y?0.1,画出z1的三维曲面图,并叠在上题的图中。 5. 设x?cos?t?,y?sin?Nt???,若N?2,??0,?3,?2,?,在4个子图中分别
画出其曲线。
?x2?y2?z2?646. 绘制空间曲线:?
y?z?0?7. 绘制??sin(2?)cos(2?)的极坐标图。
8. 在0?x?2?区间内,绘制曲线y?2e?0.5xsin(2?x)。
三、实验程序:
(1)
x=linspace(0,2*pi,125);
y=cos(x).*(0.5+3*sin(x)./(x.^2+1)); plot(x,y)
(2)
t=-45:0.01:45; x=t.*sin(3*t);
y=t.*cos(3*t); z=t;
plot3(x,y,z)
(3) x=-2:0.1:2; y=x;
[X,Y]=meshgrid(x,y);
Z=(X.^2)*exp(-(X.^2+Y.^2)); surf(Z)
(4) x=-2:0.1:2; y=x;
[X,Y]=meshgrid(x,y);
Z=X.^2.*exp(-(X.^2+Y.^2)); surf(Z);hold on
Z2=0.05*X-0.05*Y+0.1; surf(Z2)
(5) N=2;
t=0:pi/20:2*pi; x=cos(t);
a=0;y=sin(N*t+a);subplot(2,2,1);plot(x,y) a=pi/3;y=sin(N*t+a);subplot(2,2,2);plot(x,y) a=pi/2;y=sin(N*t+a);subplot(2,2,3);plot(x,y) a=pi;y=sin(N*t+a);subplot(2,2,4);plot(x,y)
(6)
t=0:0.01:2*pi; x=8*sin(t);
y=4*sqrt(2).*cos(t); z=-4*sqrt(2).*cos(t); plot3(x,y,z)
(7)
t=0:pi/100:2*pi; y=sin(2*t).*cos(2*t); polar(t,y) (8)
x=0:pi/100:2*pi;
y=2*exp(-0.5*x).*sin(2*pi*x);
相关推荐: