实验名称实验一MATLAB简介及基本操作实验二符号函数及一元微积分实验目的熟悉MATLAB的软件环境并了解MA TLAB基本命令和基本函数及基本运算掌握符号函数的计算绘制二维图形会建立符号函数,掌握符号函数的运算了解如何求符号函数的极限,导数及一元符号函数的积分实验准备熟悉MATLAB的的软件环境及其工作界面简介实验内容、过程与结果1.采用不同的命令求1.6180389的整数.程序:>> x=1.6180389;>> round(x)运行结果:ans =2程序:>> x=1.6180389;>> fix(x)运行结果:ans =1程序:>> x=1.6180389;>> floor(x)运行结果:ans = 1程序:>> x=1.6180389;>> ceil(x)运行结果:ans =22.利用Matlab计算下列简单算术运算:(1)2158.21+645835÷;程序:>> 2158.21+6458/35运行结果:ans = 2.3427e+003(2)45323.278 2.563π-+;程序:>> 3.278^45-2.56^32+3*pi运行结果:ans =1.5937e+023(3)sin48+cos24ln3.56-;程序:>>sin(48*pi/180)+cos(24*pi/180)-log(3.56)运行结果:ans =0.3869(4)tan56|3 5.2518|+-.程序:>> tan(56*pi/180)+abs(3-5.2518)运行结果:ans =3.73443.求下列函数在指定点的函数值:(1)523679y x x x=-+-,7.23x=;程序:>> x=7.23x =7.2300>> y=3*x^5-6*x^2+7*x-9运行结果:y =5.8995e+004实验内容、过程与结果(2)22ln(38)5lny x x=+-, 3.25x=.程序:>> x=3.25x =3.2500>> y=2*log(3*x+8)^2-5*log(x)运行结果:y =10.65394.输入下列向量或矩阵:(1)(1 4 7 10 13 16 19 22 25 28);程序:>> [1 4 7 10 13 16 19 22 25 28]运行结果:ans =1 4 7 10 13 16 19 22 25 28(2)213316429-⎡⎤⎢⎥-⎢⎥-⎢⎥⎣⎦;程序:>> [2 -1 3;3 1 -6;4 -2 9]运行结果:ans =2 -1 33 1 -64 -2 9(3)1111234549162582764125⎡⎤⎢⎥⎢⎥⎢⎥⎢⎥⎣⎦.程序:>> [1 1 1 1;2 3 4 5;4 9 16 25;8 27 64 125]运行结果:ans =1 1 1 12 3 4 54 9 16 258 27 64 1255. 求下列各组函数的复合函数或反函数:(1)3()3f x x=+,()3tan(32)g x x=-,求(())f g x;程序:>> syms x y>> f=x^3+3;g=3*tan(3*x-2)g =3*tan(3*x-2)>> compose(f,g)运行结果:ans =27*tan(3*x-2)^3+3实验内容、过程与结果(2)2(ln)2y x=+,求反函数;程序:>> finverse((log(x))^2+2)运行结果:ans =exp((-2+x)^(1/2))(3)3123xyx-=+,求反函数.程序:>> syms x>> finverse((3*x-1)/(2+3*x))运行结果:ans =-1/3*(1+2*x)/(-1+x)6. 按要求作下列函数的图像:(1)用plot命令作3123y x=-,[2,2]x∈-,2lnxy x=-,[1,]x e∈的图像程序:>> X=[-2:1/10:2];>> Y=1/3*X.^3-2;>>plot(X,Y)-2-1.5-1-0.500.51 1.52-5-4-3-2-11程序:>> X=[1:1/10:exp(1)];>> Y=2.^X+log(X);>> plot(X,Y)1 1.2 1.4 1.6 1.82 2.2 2.4 2.6 2.82345678(2)在同一窗口用不同线型作2xy=,2logy x=的图像,并加标注;程序:> > fplot('2.^X',[-2,2])>> fplot('log(X)',[0,2])1020304050607080实验内容、过程与结果(3)用polar命令作2rθ=,[0,2]θπ∈,2cosrθ=,[0,]θπ∈的极坐标图像.程序:>> theta=[0:0.01:2*pi];>> polar(theta,2*(theta),'-k')510153021060240902701203001503301800程序:>> fplot('2.^X-log(X)',[1,exp(1)])>> theta=[0:0.01:pi];>> polar(theta,2*cos(theta),'-k')0.511.5230210602409027012030015033018007. 求下列极限:(1)2251lim4xx xx→--+-;程序: >> syms x>> limit((sqrt(5-x)-sqrt(x+1))/(x^2-4),x,2)运行结果:ans =-1/12*3^(1/2)(2)2sinlim5cosxxxe xe x→∞+-;程序:>> syms x y>> f=2*exp(x)+sin(x);g=5*exp(x)-cos(x);>> limit(f/g,x,inf)运行结果:ans =limit((2*exp(x)+sin(x))/(5*exp(x)-cos(x)),x = Inf)实验内容、过程与结果(3)lim sin lnxx x→+;程序:>> syms x>> limit(sin(x)*log(x),x,+0)运行结果:ans =0(4)tan214lim(tan)xxxπ→-;程序: >> f=(tan(x))^(tan(2*x));>> limit(f,x,pi/4)运行结果:ans =1/exp(1)8. 求下列函数的导数:(1)22xyx a x=-+,求y';程序: >> syms x y t u z a b>> S=x/(x-sqrt(a^2+x^2));>> diff(S)运行结果:ans =1/(x - (a^2 + x^2)^(1/2)) + (x*(x/(a^2 + x^2)^(1/2) - 1))/(x - (a^2+ x^2)^(1/2))^2(2)2arctan(1)y x=-,求y'';程序: >> syms x y t u z a b>> S=atan(1-x^2);>> diff(S,2)运行结果:ans =(8*x^2*(x^2 - 1))/((x^2 - 1)^2 + 1)^2 - 2/((x^2 - 1)^2 + 1) (3)4arcsin1y x=-,求y''';程序: >> syms x y t u z a b>> S=asin(sqrt(1-x^4));>> diff(S,3)运行结果:ans = (36*x^5)/((1 - x^4)^(1/2)*(x^4)^(3/2)) - (12*x)/((1 - x^4)^(1/2)*(x^4)^(1/2))(4)332x y xy+=,求y',y'';程序: >> S=x^3+y^3-2*x*y;>> -diff(S,x)/diff(S,y)运行结果:ans =-(2*y - 3*x^2)/(2*x - 3*y^2)程序:>> S=x^3+y^3-2*x*y;>> -diff(S,x,2)/diff(S,y,2)运行结果:ans = -x/y实验内容、过程与结果(5)232sin(2)x xy+-=,求y'.程序: >> syms x y t u z a b>> S=sin(2^(x^2+3*x-2));>> -diff(S,x)/diff(S,y)运行结果:ans =Inf9. 求下列不定积分:(1)2lnx xdx⎰;程序: >> syms x y z a b>> S=x^2*log(x);>> int(S)运行结果:ans =(x^3*(log(x) - 1/3))/3(2)2sinxe xdx⎰;程序: >>syms x y z a b>> S=exp(2*x)*sin(x);>> int(S)运行结果:ans =-(exp(2*x)*(cos(x) - 2*sin(x)))/5(3)225x x dx-+⎰;程序: >> syms x y z a b>> S=sqrt(x^2-2*x+5);>> int(S)运行结果:ans = (x/2 - 1/2)*(x^2 - 2*x + 5)^(1/2) - 2*asin((x*i)/2 - i/2)*i (4)322xdxx-⎰;程序: >> syms x y z a b>> S=x^3/sqrt(2-x^2);>> int(S)运行结果:ans =-((2 - x^2)^(1/2)*(x^2 + 4))/3(5)4sin4xdx⎰;程序: >> S=(sin(4*x))^4;>> int(S)运行结果:ans =(3*x)/8 - sin(8*x)/16 + sin(16*x)/128实验内容、过程与结果(6)2211arctan1(1)xdxx x⎛⎫-⎪++⎝⎭⎰程序: >> syms x y z a b>> S=(1/(1+x^2)-1/((1+x)^2))*atan(x);>> int(S)运行结果:ans =log(x^2 + 1)/4 - log(x + 1)/2 - atan(x)/2 + atan(x)^2/2 + atan(x)/(x + 1)10. 求下列定积分:(1)341cos2xdxπ+⎰;程序: >> syms x y z a b>> S=sqrt(1+cos(2*x));>> int(S,0,pi*3/4)运行结果:ans =2*2^(1/2) - 1(2)1lnex xdx⎰;程序: >> syms x y z a b>> S=x*log(sqrt(x));>> int(S,1,exp(1))运行结果:ans =(9366741398929500034245406117369*log(3060513257434037/1125899906842624))/5 070602(3)2xx e dx+∞-⎰;程序: >> syms x y z a b>> S=x^2*exp(-x);>> int(S,0,inf)运行结果:ans = 2(4)32cos sinx xdxπ⎰;程序: >> syms x y z a b>> S=(cos(x))^2*sin(x);>> int(S,0,pi/2)运行结果:ans =1/3实验内容、过程与结果(5)1322032xdxx x-+⎰;程序: >> syms x y z a b>> S=x^3/(x^2-3*x+2);>> int(S,0,1/2)运行结果:ans =13/8 - log(32768/6561)(6)11422221dxx x x++⎰程序: >> syms x y z a b>> S=1/(x*sqrt(2*x^4+2*x^2+1));>> int(S,1/2,1)运行结果:ans =log(26^(1/2) + 5)/2 - log(5^(1/2) + 2)/2教师评语。