一
h=figure('MenuBar','figure','color','r','WindowButtonDownFcn','disp("Left Button Pressed")')
二
x=-2:0.01:2; y=1/2.*log(x+sqrt(1+x.^2)); h=line(x,y); set(h,'color','r','linestyle',':','linewidth',2) text(1,exp(2),'y=1/2*log(x+sqrt(1+x^2))') t=-2:0.01:2; x=t.^2; y=5.*t.^3; h1=line(t,x); set(h1,'color','r','linestyle',':','linewidth',2) text(-1.5,0,'x=t.^2') hold on h2=line(t,y); set(h2,'color','b','linestyle',':','linewidth',3) text(1.5,20,'y=5.*t.^3') x=-2:0.01:2; y=(1+x.^2)./(1+x.^4); h=line(x,y); set(h,'color','r','linestyle',':','linewidth',2) text(1,1,'y=(1+x.^2)./(1+x.^4)') x=-2:0.01:2; y=x.^2.*exp(2*x); h=line(x,y); set(h,'color','r','linestyle',':','linewidth',2) text(1,exp(2),'y=x^2*exp(2*x)')
三
t=-20*pi:0.1*pi:20*pi; [t,~]=meshgrid(t); x=t; y=2.*t.*cos(t); z=5.*t.*sin(t); axes('view',[-37.5,30]); surface(x,y,z) axis equal theta=0:0.01*pi:2*pi; t=0:0.01*pi:2*pi; [theta,t]=meshgrid(theta,t); x=2.*cos(theta); y=2.*sin(theta); z=t; axes('view',[-37.5,30]); surface(x,y,z) t=0:0.00001:0.001; [t,x]=meshgrid(t); v=10*exp(-0.01*x).*sin(2000*pi*t-0.2*x+pi); axes('view',[-37.5,30]); h=surface(t,x,v); title('v=10*exp(-0.01*x).*sin(2000*pi*t-0.2*x+pi)'); xlabel('t'),ylabel('x'),zlabel('v') y=0:0.01:20; x=0:0.01:20; [x,y]=meshgrid(x,y); z=y.^3; axes('view',[-37.5,30]); h=surface(x,y,z);
四
x=0:0.01:2*pi; y1=sin(x); y2=cos(x); y3=tan(x); y4=cot(x); subplot(2,2,1); plot(x,y1); subplot(2,2,2); plot(x,y2); subplot(2,2,3); plot(x,y3); subplot(2,2,4); plot(x,y4);
五
t=linspace(0,2*pi,6); k=t(1:length(t)-1); patch(sin(k),cos(k),1:length(k),'facecolor','interp'); colormap summer; axis equal;
六
r=150; a=150; b=150; para1=[a-r,b-r,2*r,2*r]; para2=[a-r+300,b-r,2*r,2*r] rectangle('Position',para1,'Curvature',[1 1],'EdgeColor','r') hold on rectangle('Position',para2,'Curvature',[1 1],'EdgeColor','r') axis equal
注:考试范围仅到此,所以simulaition仿真及之后的章节没有作答。由于上次挂了个网址被删啦,若读者需要,请自行查阅相关资料(话说csdn不给返回底稿的吗…)