资源描述
1第一次练习教学要求:熟练掌握 Matlab 软件的基本命令和操作,会作二维、三维几何图形,能够用 Matlab 软件解决微积分、线性代数与解析几何中的计算问题。补充命令vpa(x,n) 显示 x 的 n 位有效数字,教材 102 页fplot(f(x),a,b) 函数作图命令,画出 f(x)在区间a,b上的图形在下面的题目中 为你的学号的后 3 位(1-9 班)或 4 位(10 班以上)m1.1 计算 与30sinlixxsinlimx程序:syms xlimit(1001*x-sin(1001*x)/x3,x,0)结果:1003003001/6程序:syms xlimit(1001*x-sin(1001*x)/x3,x,inf)结果:01.2 ,求 cos10xmyey程序:syms xdiff(exp(x)*cos(1001*x/1000),2)结果:-2001/1000000*exp(x)*cos(1001/1000*x)-1001/500*exp(x)*sin(1001/1000*x)21.3 计算 210xyed程序:dblquad(x,y) exp(x.2+y.2),0,1,0,1)结果:2.139350195142281.4 计算42xdm程序:syms xint(x4/(10002+4*x2)结果:1/12*x3-1002001/16*x+1003003001/32*atan(2/1001*x)1.5 (10)cos,xyemy求程序:syms xdiff(exp(x)*cos(1000*x),10)结果:-1009999759158992000960720160000*exp(x)*cos(1001*x)-10090239998990319040000160032*exp(x)*sin(1001*x)31.6 给出 在 的泰勒展式(最高次幂为 4). 10.mx0程序:syms xtaylor(sqrt(1001/1000+x),5)结果:1/100*10010(1/2)+5/1001*10010(1/2)*x-1250/1002001*10010(1/2)*x2+625000/1003003001*10010(1/2)*x3-390625000/1004006004001*10010(1/2)*x41.7 Fibonacci 数列 的定义是 ,nx12,x用循环语句编程给出该数列的前 20 项(要求12,(3,4)nnx将结果用向量的形式给出) 。程序:x=1,1;for n=3:20x(n)=x(n-1)+x(n-2);endx结果:Columns 1 through 10 1 1 2 3 5 8 13 21 34 55Columns 11 through 20 89 144 233 377 610 987 1597 2584 4181 676541.8 对矩阵 ,求该矩阵的逆矩阵,特征值,特210410Am征向量,行列式,计算 ,并求矩阵 ( 是对角矩阵) ,使得6,PD。1APD程序与结果:a=-2,1,1;0,2,0;-4,1,1001/1000;inv(a)0.50100100100100 -0.00025025025025 -0.500500500500500 0.50000000000000 02.00200200200200 -0.50050050050050 -1.00100100100100eig(a)-0.49950000000000 + 1.32230849275046i-0.49950000000000 - 1.32230849275046i2.00000000000000p,d=eig(a)p =0.3355 - 0.2957i 0.3355 + 0.2957i 0.2425 0 0 0.9701 0.8944 0.8944 0.0000 注:p 的列向量为特征向量d =-0.4995 + 1.3223i 0 0 0 -0.4995 - 1.3223i 0 0 0 2.0000 a611.9680 13.0080 -4.99100 64.0000 019.9640 -4.9910 -3.0100 51.9 作出如下函数的图形(注:先用 M 文件定义函数,再用 fplot 进行函数作图): 1202()1)xxf函数文件 f.m: function y=f(x)if 0 f=inline(x+1000/x)/2);x0=3;for i=1:20;x0=f(x0);fprintf(%g,%gn,i,x0);end运行结果:1,168.167 11,31.62282,87.0566 12,31.62283,49.2717 13,31.62284,34.7837 14,31.62285,31.7664 15,31.62286,31.6231 16,31.62287,31.6228 17,31.62288,31.6228 18,31.62289,31.6228 19,31.622810,31.6228 20,31.6228由运行结果可以看出, ,数列 收敛,其值为 31.6228。nx112.2 求出分式线性函数 的不动点,再编程判212(),()xxmff断它们的迭代序列是否收敛。解:取 m=1000.(1)程序如下:f=inline(x-1)/(x+1000);x0=2;for i=1:20;x0=f(x0);fprintf(%g,%gn,i,x0);end运行结果:1,0.000998004 11,-0.0010012,-0.000999001 12,-0.0010013,-0.001001 13,-0.0010014,-0.001001 14,-0.0010015,-0.001001 15,-0.0010016,-0.001001 16,-0.0010017,-0.001001 17,-0.0010018,-0.001001 18,-0.0010019,-0.001001 19,-0.00100110,-0.001001 20,-0.001001由运行结果可以看出, ,分式线性函数收敛,其值为-0.001001。易见函数的不动点为-0.001001(吸引点) 。(2)程序如下:f=inline(x+1000000)/(x+1000);x0=2;12for i=1:20;x0=f(x0);fprintf(%g,%gn,i,x0);end运行结果:1,998.006 11,618.3322,500.999 12,618.3023,666.557 13,618.3144,600.439 14,618.3095,625.204 15,618.3116,615.692 16,618.317,619.311 17,618.3118,617.929 18,618.319,618.456 19,618.3110,618.255 20,618.31由运行结果可以看出, ,分式线性函数收敛,其值为 618.31。易见函数的不动点为 618.31(吸引点) 。2.3 下面函数的迭代是否会产生混沌?(56 页练习 7(1) )1202()1)xxf解:程序如下:f=inline(1-2*abs(x-1/2);x=;y=;x(1)=rand();y(1)=0;x(2)=x(1);y(2)=f(x(1);13for i=1:100;x(1+2*i)=y(2*i);x(2+2*i)=x(1+2*i);y(2+2*i)=f(x(2+2*i);endplot(x,y,r);hold on;syms x;ezplot(x,0,1/2);ezplot(f(x),0,1);axis(0,1/2,0,1); hold off运行结果:0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.500.10.20.30.40.50.60.70.80.91x1 - 2 abs(x - 1/2)142.4 函数 称为 Logistic 映射,试从“蜘蛛网”()1)(01)fxx图观察它取初值为 产生的迭代序列的收敛性,将观察记录填人下.5表,若出现循环,请指出它的周期 (56 页练习 8)3.3 3.5 3.56 3.568 3.6 3.84序列收敛情况 T=2 T=4 T=8 T=9 混沌 混沌解:当 =3.3 时,程序代码如下:f=inline(3.3*x*(1-x);x=;y=;x(1)=0.5;y(1)=0;x(2)=x(1);y(2)=f(x(1);for i=1:1000;x(1+2*i)=y(2*i);x(2+2*i)=x(1+2*i);y(1+2*i)=x(1+2*i);y(2+2*i)=f(x(2+2*i);endplot (x,y,r);hold on;syms x;ezplot(x,0,1);ezplot(f(x),0,1);axis(0,1,0,1);hold off 运行结果:150 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 100.10.20.30.40.50.60.70.80.91x-(33 x (x - 1)/10当 =3.5 时,上述程序稍加修改,得:0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 100.10.20.30.40.50.60.70.80.91x-(7 x (x - 1)/2当 =3.56 时,得:160 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 100.10.20.30.40.50.60.70.80.91x-(89 x (x - 1)/25当 =3.568 时,得:0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 100.10.20.30.40.50.60.70.80.91x-(446 x (x - 1)/12517当 =3.6 时,得:0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 100.10.20.30.40.50.60.70.80.91x-(18 x (x - 1)/5当 =3.84 时,得:0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 100.10.20.30.40.50.60.70.80.91x-(96 x (x - 1)/25182.5 对于 Martin 迭代,取参数 为其它的值会得到什么图形?参考下,abc表(取自 63 页练习 13) cm m m-m -m m-m m/1000 -mm/1000 m/1000 0.5m/1000 m -mm/100 m/10 -10-m/10 17 4解:取 m=10000;迭代次数 N=20000;在 M-文件里面输入代码:function Martin(a,b,c,N)f=(x,y)(y-sign(x)*sqrt(abs(b*x-c);g=(x)(a-x);m=0;0;for n=1:Nm(:,n+1)=f(m(1,n),m(2,n),g(m(1,n);endplot(m(1,:),m(2,:),kx);axis equal在命令窗口中执行 Martin(10000,10000,10000,20000) ,得:19-2 -1.5 -1 -0.5 0 0.5 1 1.5 2x 104-50000500010000150002000025000执行 Martin(-10000,-10000,10000,20000) ,得:-2 -1.5 -1 -0.5 0 0.5 1 1.5 2x 104-25000-20000-15000-10000-50000500020执行 Martin(-10000,10,-10000,20000) ,得:-12000 -10000 -8000 -6000 -4000 -2000 0 2000-10000-8000-6000-4000-20000执行 Martin(10,10,0.5,20000) ,得:-20 -10 0 10 20 30-10-505101520253021执行 Martin(10,10000,-10000,20000) ,得:-5000-4000-3000-2000-1000 0 1000 2000 3000 4000 5000-4000-3000-2000-100001000200030004000执行 Martin(100,1000,-10,20000) ,得:-600 -400 -200 0 200 400 600 800-500-400-300-200-100010020030040050022执行 Martin(-1000,17,4,20000) ,得:-1200 -1000 -800 -600 -400 -200 0 200-1200-1000-800-600-400-20002.6 能否找到分式函数 (其中 是整数),使它产生2axbcde,abcde的迭代序列(迭代的初始值也是整数)收敛到 (对于 为整数的学3m3号,请改为求 )。如果迭代收敛,那么迭代的初值与收敛的速度有什310m么关系.写出你做此题的体会.提示:教材 54 页练习 4 的一些分析。若分式线性函数 的迭代收敛到指定的数 ,则 为()axbfcd2的不动点,因此()fx2abcd化简得: 。(2)()0cbd若 为整数,易见 。,a2,ca23取满足这种条件的不同的 以及迭代初值进行编。,abcd解:取 m=10000;根据上述提示,取:运行结果如下:1,0.007777772,9999.43,0.0002000184,100005,0.00026,100007,0.00028,100009,0.000210,1000011,0.000212,1000013,0.000214,1000015,0.000216,1000017,0.000218,1000019,0.000220,1000021,0.000222,1000023,0.000224,1000025,0.000226,1000027,0.000228,1000029,0.000230,1000031,0.000232,1000033,0.00022434,1000035,0.000236,1000037,0.000238,1000039,0.000240,1000041,0.000242,1000043,0.000244,1000045,0.000246,1000047,0.000248,1000049,0.000250,1000051,0.000252,1000053,0.000254,1000055,0.000256,1000057,0.000258,1000059,0.000260,1000061,0.000262,1000063,0.000264,1000065,0.000266,1000067,0.000268,1000069,0.000270,1000071,0.00022572,1000073,0.000274,1000075,0.000276,1000077,0.000278,1000079,0.000280,1000081,0.000282,1000083,0.000284,1000085,0.000286,1000087,0.000288,1000089,0.000290,1000091,0.000292,1000093,0.000294,1000095,0.000296,1000097,0.000298,1000099,0.0002100,10000若初值取为 1000,运行结果:1,0.0112,9998.83,0.0002000364,100005,0.00026,100007,0.0002268,100009,0.000210,1000011,0.000212,1000013,0.000214,1000015,0.000216,1000017,0.000218,1000019,0.000220,1000021,0.000222,1000023,0.000224,1000025,0.000226,1000027,0.000228,1000029,0.000230,1000031,0.000232,1000033,0.000234,1000035,0.000236,1000037,0.000238,1000039,0.000240,1000041,0.000242,1000043,0.000244,1000045,0.00022746,1000047,0.000248,1000049,0.000250,1000051,0.000252,1000053,0.000254,1000055,0.000256,1000057,0.000258,1000059,0.000260,1000061,0.000262,1000063,0.000264,1000065,0.000266,1000067,0.000268,1000069,0.000270,1000071,0.000272,1000073,0.000274,1000075,0.000276,1000077,0.000278,1000079,0.000280,1000081,0.000282,1000083,0.00022884,1000085,0.000286,1000087,0.000288,1000089,0.000290,1000091,0.000292,1000093,0.000294,1000095,0.000296,1000097,0.000298,1000099,0.0002100,10000若初值取为-1,运行结果:1,4999.52,0.00060013,100004,0.00025,100006,0.00027,100008,0.00029,1000010,0.000211,1000012,0.000213,1000014,0.000215,1000016,0.000217,1000018,0.000219,1000020,0.00022921,1000022,0.000223,1000024,0.000225,1000026,0.000227,1000028,0.000229,1000030,0.000231,1000032,0.000233,1000034,0.000235,1000036,0.000237,1000038,0.000239,1000040,0.000241,1000042,0.000243,1000044,0.000245,1000046,0.000247,1000048,0.000249,1000050,0.000251,1000052,0.000253,1000054,0.000255,1000056,0.000257,1000058,0.00023059,1000060,0.000261,1000062,0.000263,1000064,0.000265,1000066,0.000267,1000068,0.000269,1000070,0.000271,1000072,0.000273,1000074,0.000275,1000076,0.000277,1000078,0.000279,1000080,0.000281,1000082,0.000283,1000084,0.000285,1000086,0.000287,1000088,0.000289,1000090,0.000291,1000092,0.000293,1000094,0.000295,1000096,0.0002
展开阅读全文