1/617.用fplot绘制曲线cos(tanπx)。答案:fplot('cos(tan(pi*x))',[0.0110.1],1e-3)。18.用ezplot绘制曲线ey+cosxx+y=0。答案:ezplot('exp(y)+cos(x)/x+y')。19.用ezsurf绘制曲面。2/6{x=e−scosty=e−ssintz=t(0≤s≤8,0≤t≤5π)Answer:ezsurf('exp(-s)*cos(t)','exp(-s)*sin(t)','t',[0,8,0,5*pi])21.画曲面和等高线z=x2y+√yx(−5≤x≤5,0≤y≤10)的图像答案:x=linspace(-5,5,100);y=linspace(0,10,100);[X,Y]=meshgrid(x,y);%1.构造数据网格Z=X.^2.*Y+sqrt(X)./X;%2.建函数surf(X,Y,Z)CONTOUR(X,Y,Z)3/6CONTOURF(X,Y,Z);26.画出牛顿环的干涉图样。f2014120401.m在光学上,牛顿环是一个薄膜干涉现象。光的一种干涉图样,是一些明暗相间的同心圆环。在加工光学元件时,广泛采用牛顿环的原理来检查平面或曲面的面型准确度。4/6%program画出牛顿环的干涉图样。f2014120401.mlambda=589.3e-9;R=0.8551;x=-3:0.01:3;y=x;%设定两轴的范围及间隔[X,Y]=meshgrid(x,y);r2=X.^2+Y.^2;%产生n×n个网格点的坐标B=2*cos(2*pi*r2*1.e-6/R/lambda);%光强的计算colormap(gray(255))W=B*255/5;image(x,y,W)title('牛顿环干涉图样');xlabel('x(mm)');ylabel('y(mm)');27.画出等容、等压、等温曲线。f2014112702.m%program画出等容、等压、等温曲线。f2014112702.m%由理想气体状态方程PV=nRT,令nR=1%等温图,令T=1figuresubplot(1,3,1)P=0.001:0.01:10;V=1./P;plot(P,V);xlabel('P');ylabel('V');set(gca,'xlim',[010],'ylim',[010])title('等温图(T=1)','fontsize',15)5/6%等压图,令P=1subplot(1,3,2)V=0:10;T=V;plot(V,T);xlabel('V');ylabel('T');set(gca,'xlim',[010],'ylim',[010])title('等压图(P=1)','fontsize',15)%等容图,令V=1subplot(1,3,3)P=0:10;T=P;plot(P,T);xlabel('P');ylabel('T');set(gca,'xlim',[010],'ylim',[010])title('等容图(V=1)','fontsize',15)28.画出表面水波的干涉图样。f2014112701.m%program画出表面水波的干涉图样f2014112701.m%缺陷:理论应标注a=4;w=4;A0=1;A1=1;k=1;[x,y]=meshgrid(-4*pi:pi/20:4*pi,-4*pi:pi/20:4*pi);r1=sqrt((x-a).^2+y.^2)+5;c1=1./r1;r2=sqrt((x+a).^2+y.^2)+5;c2=1./r2;t=0:0.1:10figureforj=1:91z=A0*c1.*cos(w*(t(j)-k*r1))+A1*c2.*cos(w*(t(j)-k*r2));surf(x,y,z);colormap(gray);axisequal;shadinginterp;6/6view(50,36);axisoff;title(['剩余传播时间(秒):',num2str(fix((91-j)*0.2))],...'fontsize',20,'Color','r')pause(0.2)end