资源描述:
《MATLAB期末上机试题带答案》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、MATLAB期末上机考试试题带答案版姓名:学号:成绩:1.请实现下图:y=sin(x)10.80.60.40.2y0-0.2-0.4-0.6-0.8-150100150200250xx=linspace(0,8*pi,250);y=sin(x);plot(x,y)area(y,-1)xlabel('x')ylabel('y')title('y=sin(x)')2.请实现下图:x=linspace(0,2*pi,100);y1=sin(x);subplot(2,2,1)plot(x,y1,'k--')gridonxlabel('x')ylabel('y')
2、title('sin(x)')legend('y=sin(x)')y2=cos(x);subplot(2,2,2)plot(x,y2,'r--')gridonxlabel('x')ylabel('y')title('cos(x)')legend('y=cos(x)')y3=tan(x);subplot(2,2,3)plot(x,y3,'k-')gridonxlabel('x')ylabel('y')title('tan(x)')legend('y=tan(x)')y4=cot(x);subplot(2,2,4)plot(x,y4)gridonxlabel
3、('x')ylabel('y')title('cot(x)')legend('y=cot(x)')3.解方程组:a=[321;1-13;24-4];b=[7;6;-2];x=ab4.请实现下图:'自己的姓名'1sin(x)0.8sin(2*x)0.60.40.2y0-0.2-0.4-0.6-0.8-102468101214xx=linspace(0,4*pi,1000);y1=sin(x);y2=sin(2*x);plot(x,y1,'--',x,y2,'b*')gridonxlabel('x');ylabel('y');title('耿蒙蒙')leg
4、end('sin(x)','sin(2*x)')5.请在x,y在(-2,2)内的z=xexp(-x2-y2)绘制网格图[x,y]=meshgrid(-2:0.1:2);z=x.*exp(-x.^2-y.^2);mesh(x,y,z)6.请实现peaks函数:Peaks50-5232010-1-2-2y-3x[x,y]=meshgrid(-3:1/8:3);z=peaks(x,y);mesh(x,y,z)surf(x,y,z)shadingflataxis([-33-33-88])xlabel('x');ylabel('y');title('Peaks')
5、7.请在x=[0,2],y=[-0.5*pi,7.5*pi],绘制光栅的振幅为0.4的三维正弦光栅。x=0:0.1:2;y=-0.5*pi:0.01*pi:7.5*pi;[x,y]=meshgrid(x,y)z=sin(y);mesh(x,y,z)surf(x,y,z)shadingflataxis([02-0.5*pi7.5*pi-66])8.请用ezplot函数绘制sin(x2),x的区间为0到8*pi。ezplot('x','sin(x^2)',[0,8*pi])9.样本点;x=[00.25*pi0.5*pi0.75*pipi1.25*pi1.5*
6、pi1.75*pi2*pi];y=[00.5*2.^0.510.5*2.^0.50-0.5*2.^0.5-1-0.5*2.^0.50];对样本点进行spline插值。并将样本点和插值后的数据进行绘图。x0=[00.25*pi0.5*pi0.75*pipi1.25*pi1.5*pi1.75*pi2*pi];y0=[00.5*2.^0.510.5*2.^0.50-0.5*2.^0.5-1-0.5*2.^0.50];plot(x0,y0,'o')holdonx=[0:0.01:2*pi];y=interp1(x0,y0,x,'spline')plot(x,y)
7、10.请实现下图:利用多项式求根方法求解x^3-x^2-3=0。y=[1-10-3];r=roots(y)11.A=2i+5j+7kB=8i+4j+6k求C=A×BA=[257];B=[846];C=conv(A,B)12.A=2i+5j+7kB=8i+4j+6k求C=A●BA=[257];B=[846];C=A*B'13.用不同标度在同一坐标内绘制曲线y1=e-0.3xcos(2x)及曲线y2=10e-1.5x。x=0:pi/180:2*pi;y1=exp(-0.3*x).*cos(2*x);y2=10*exp(-1.5*x);plotyy(x,y1,
8、x,y2)14.请实现下图:10.80.60.40.20-0.2-0.4-0.6