题目
解答
5-1
>> ezplot('(sin(x))^2/(1+x^2)')
>> axis([-4,4,-0.1,0.45]);grid on
5-2
>> x=[0:10:1200];
>> a1=pi/6;a2=pi/4;a3=5*pi/12;
>> y1=x*tan(a1)-(9.8*x.^2)./(2*100*100*cos(a1)*cos(a1));
>> y2=x*tan(a2)-(9.8*x.^2)./(2*100*100*cos(a2)*cos(a2));
>> y3=x*tan(a3)-(9.8*x.^2)./(2*100*100*cos(a3)*cos(a3));
>> plot(x,y1,'-',x,y2,':',x,y3,'*');grid on
5-3
>> theta=[0:2*pi];
>> r=-cos(2*theta).*sec(theta);
>> [x,y]=pol2cart(theta,r);
>> subplot(1,2,1);polar(theta,r)
>> subplot(1,2,2);plot(x,y);grid on
(做出来异常奇怪。)
5-4
>> a=pi/2:4*pi/5:4*pi;
>> A=exp(i*a);
>> x=real(A);
>> y=imag(A);
>> fill(x,y,'y')
>> axis square
>> hold on
>> x1=-1:0.001:1;
>> y1=sqrt(1^2-x1.^2);
>> y2=-sqrt(1^2-x1.^2);
>> plot(x1,y1,x1,y2)
5-5
>> bar3(magic(5))
>> colormap(spring)
5-6
>> o=[2000 1500 600 200 300 700];
>> [m,i]=max(o)
m =
2000
i =
1
>> explode=zeros(size(o));
>> explode(i)=1
explode =
1 0 0 0 0 0
>> pie(o,explode)
5-7
>> a=-pi/2:pi/30:pi/2;
>> b=0:pi/9:pi/4;
>> r1=0.5+0.45*cos(a);
>> r2=0.5+0.39*sin(b);
>> r=[0.5,r1,0.5,0.5,r2];
>> cylinder(r,24)
>> colormap(spring)