实战演练 习题
解答 1 程序
x=-4:0.1:4; >> y=sin(x).^2./(1+x.^2); >> plot(x,y) 1 2 3 图像
2 程序
function paowuxian(theta) x=0:50:1200; t=theta/180*pi; y=x*tan(t)-9.8/(2*(100*cos(t))^2)*x.^2; plot(x,y) hold on;grid on 1 2 3 4 5 6 >> paowuxian(30) >> paowuxian(45) >> paowuxian(75) 1 2 3
3 >> x=0:0.1:2*pi; >> r=-cos(2*x).*sec(x); >> polar(x,r) >> figure >> x1=r.*cos(x);y1=r.*sin(x); >> plot(x1,y1) 1 2 3 4 5 6
4 程序(m文件)
theta=0:pi/10:pi*4; x=1.5*sin(theta)+sin(1.5*theta); y=1.5*cos(theta)-cos(1.5*theta); plot(x,y) 1 2 3 4
5 >> a=magic(5)
a =
17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9
>> bar(a) 1 2 3 4 5 6 7 8 9 10 11
6 >> a=[2200 1500 600 200 300 700 ]; >> [max,i]=max(a)
max =
2200
i =
1
>> b=zeros(size(a)); >> b(i)=1; >> pie(a,b) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
7 %huapinglititu theta1=-pi/2:pi/24:pi/2; theta2=0:pi/12:pi/3; r1=0.5+cos(theta1); r2=0.5+0.8*sin(theta2); r=[r1,0.5,0.5,r2]; cylinder(r) 1 2 3 4 5 6 7
总结思考 做一些题,总结,并熟练掌握一下最近学习的三维图函数。