1、南邮 数学实验参考答案选题版1.3、 syms x y; a=int(int(exp(x2+y2),x,0,1),y,0,1) a = (pi*erfi(1)2)/41.7、 n=20; for i=1:(n-2) a(1)=1;a(2)=1; a(i+2)=a(i+1)+a(i); end a ans = 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 67651.8、 A=-2,1,1;0,2,0;-4,1,303/1000; inv(A)ans = 0.0893 0.1027 -0.2946 0 0.5000 0
2、 1.1786 -0.2946 -0.5893 eig(A)ans = -0.8485 + 1.6353i -0.8485 - 1.6353i 2.0000 p,D=eig(A)p = 0.2575 - 0.3657i 0.2575 + 0.3657i 0.2425 0 0 0.9701 0.8944 0.8944 0.0000 D = -0.8485 + 1.6353i 0 0 0 -0.8485 - 1.6353i 0 0 0 2.0000 det(A)ans = 6.7880 A6ans = 45.0194 4.7452 -6.3718 0 64.0000 0 25.4870 -6.37
3、18 30.3452 A.6ans = 1.0e+003 * 0.0640 0.0010 0.0010 0 0.0640 04.0960 0.0010 0.00001.9、M文件定义如下:function y=f(x)if x=0&x1/2&x A=4 -2 2;-3 0 5;1 5*303 3; B=1 3 4;-2 0 -3;2 -1 -1; det(A)ans = -39418 2*A-Bans = 7 -7 0 -4 0 13 0 3031 7 A*Bans = 12 10 20 7 -14 -17 -3023 0 -4544 A.*Bans = 4 -6 8 6 0 -15 2 -1
4、515 -3 A*B-1ans = -0.4211 -1.4737 0.7368 -1.0000 -2.0000 -3.0000 637.7368 716.5789 398.2105 A-1*Bans = 0.3467 0.5763 0.9995 0.0015 -0.0017 -0.0013 -0.1920 0.3458 -0.0003 A2ans = 24 3022 4 -7 7581 9 -4538 4543 7586 Aans = 4 -3 1 -2 0 1515 2 5 31.12、syms x;fplot(1/(sqrt(2*pi)*514/600)*exp(-(x)2)/2),-3
5、,3,r)hold onfplot(1/(sqrt(2*pi)*514/600)*exp(-(x-1)2)/2),-3,3,b)hold onfplot(1/(sqrt(2*pi)*514/600)*exp(-(x+1)2)/2),-3,3,g)hold offlegend(u为0,u为-1,u为1)syms x;fplot(1/(sqrt(2*pi)*1)*exp(-(x)2)/2),-3,3,r)hold onfplot(1/(sqrt(2*pi)*2)*exp(-(x)2)/2),-3,3,b)hold onfplot(1/(sqrt(2*pi)*4)*exp(-(x)2)/2),-3,
6、3,-)hold onfplot(1/(sqrt(2*pi)*5.14)*exp(-(x)2)/2),-3,3,g)hold off1.15、 ezplot(exp(x)-3*303*x.2,-10,10);grid on fsolve(exp(x)-3*303*x.2,0) ans = -0.0326第二次练习:2.1、f=inline(x+7/x)/2);syms x;x0=3;for i=1:1:15x0=f(x0);fprintf(%g,%gn,i,x0);end结果如下:1,2.666672,2.645833,2.645754,2.645755,2.645756,2.645757,2
7、.645758,2.645759,2.6457510,2.6457511,2.6457512,2.6457513,2.6457514,2.6457515,2.645752.2、同2.1的方法,把f=inline(x+7/x)/2);把未知表达式改一下就可以了;2.3、 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);for i=1:10000x(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
8、,r);hold on;syms x;ezplot(x,0,1);ezplot(f(x),0,10);axis(0,1,0,1);hold off答案如下:2.4、 以=3.5为例;其他的把改变就可以了;f=inline(3.5(是的取值)*x*(1-x);x=;y=;x(1)=0.5;y(1)=0;x(2)=x(1);y(2)=f(x(1);for i=1:10000x(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
9、);ezplot(f(x),0,1);axis(0,1,0,1);hold off结果如下:整体结果如下:3.33.53.563.5683.63.84序列收敛情况不收敛循环周期为2不收敛循环周期为4不收敛循环周期为8混沌混沌不收敛循环周期为32.5、对着书上的代码先输入到M文件里,然后再在命令窗口输入执行命令如:Martin(303,303,303,5000);即可。注意m文件的保存名要和函数名一致就可以了;2.6、第三次练习3.1、A=4,2;1,3;P,D=eig(A)Q=inv(P)P = 0.8944 -0.7071 0.4472 0.7071D = 5 0 0 2Q = 0.7454
10、 0.7454 -0.4714 0.9428 B=sym(5n,0;0,2n);P*B*Q ans = 2/3*5n+1/3*2n, 2/3*5n-2/3*2n 1/3*5n-1/3*2n, 1/3*5n+2/3*2n 3.2同3.1;3.3、clear all;clc;x1 = rand(1);x2 = rand(1);syms a p d x;a = sym(4,2;1,3);p, d = eig(a);for i = 1:10b = eval(limit(x1,x2*p*d.x*inv(p),10*i);b(1)/b(2)endans =0.9998ans =1.0000ans =1.0
11、000ans =1.0000ans =1ans =1ans =1ans =1ans =1ans =1 极限为1;3.4、 x0 = 1,2,3,4;a = sym(2.1,3.4,-1.2,2.3;0.8,-0.3,4.1,2.8;2.3,7.9,-1.5,1.4;3.5,7.2,1.7,-9.0);p, d = eig(a);for i = 1:10b = eval(limit(x0*p*d.x*inv(p),10*i)endb =1.0e+010 *-2.1642 -5.8793 0.6730 9.6298b =1.0e+021 *-0.7141 -1.9127 0.1887 3.0332
12、b =1.0e+031 *-2.2616 -6.0565 0.5963 9.6004b =1.0e+042 *-0.7159 -1.9171 0.1888 3.0388b =1.0e+052 *-2.2660 -6.0681 0.5975 9.6189b =1.0e+063 *-0.7173 -1.9207 0.1891 3.0447b =1.0e+073 *-2.2703 -6.0798 0.5986 9.6374b =1.0e+084 *-0.7186 -1.9244 0.1895 3.0505b =1.0e+094 *-2.2747 -6.0915 0.5998 9.6559b =1.0
13、e+105 *-0.7200 -1.9281 0.1898 3.0564 极限不存在;3.6、A2=sym(3/4,1/2,1/4;1/8,1/4,1/2;1/8,1/4,1/4);syms a b p p0;p0=0.5;0.25;0.25;for i=1:8ip=eval(A2i*p0)p0=p;endi =1p =0.56250.25000.1875i =2p =0.60350.22070.1758i =3p =0.60850.21750.1740i =4p =0.60870.21740.1739i =5p =0.60870.21740.1739i =6p =0.60870.21740.
14、1739i =7p =0.60870.21740.1739i =8p =0.60870.21740.1739 稳定下的概率为 0.6087,0.2174,0.1739。 3.7、 P,D=eig(3/4,1/2,1/4;1/8,1/4,1/2;1/8,1/4,1/4)P = -0.9094 -0.8069 0.3437 -0.3248 0.5116 -0.8133 -0.2598 0.2953 0.4695D = 1.0000 0 0 0 0.3415 0 0 0 -0.09153.8、 A = sym(3/4, 7/18; 1/4, 11/18);P, D = eig(A);p0 = 1/2
15、,1/2;p1 = P(1,:);p2 = P(2,:);b = p0/P;u = b(1)v = b(2)for i=0:10p = eval(u.*p1.*D(1).i+v.*p2.*D(4).i)endu =0v =1/2p =0.5000 0.5000p =0.5000 0.5000p =0.5000 0.5000p =0.5000 0.5000p =0.5000 0.5000p =0.5000 0.5000p =0.5000 0.5000p =0.5000 0.5000p =0.5000 0.5000p =0.5000 0.5000p =0.5000 0.5000 第四次练习 4.1
16、、 for b=1: 998a=sqrt(b+5)2-b2);if(a=floor(a)fprintf(a=%i,b=%i,c=%in,a,b,b+2)endenda=15,b=20,c=22a=25,b=60,c=62a=35,b=120,c=122a=45,b=200,c=202a=55,b=300,c=302a=65,b=420,c=422a=75,b=560,c=562a=85,b=720,c=722a=95,b=900,c=902 4.2同4.14.3、4.4、没有书不知道方程4.5、 s=0;for n=1:10000. a=ceil(rand(1)*10000); b=ceil(
17、rand(1)*10000); p=a;q=b; if(p 4.6、 s=0;for n=1:100000 r1=rand(1); r2=rand(1); if r12+r22 综合题一、1、 p=4 0 -4 0 0; r=roots(p)r = 0 0 -1 12、二、1、(a)ezplot(x.3,-5,5);hold on;ezplot(x.3+1*x,-5,5);hold on;ezplot(x.3-1*x,-5,5);hold on(b)ezplot(3*x.2,-5,5,-5,10);hold on;ezplot(3*x.2+1,-5,5,-5,10);hold on;ezplo
18、t(3*x.2-1,-5,5,-5,10);hold ongrid on 2、同1 三、2.syms s n;s=0;n=100;for i=1:n; s=s+1/(i3*sin(i)2); plot(i,s,.) hold onend;3、syms s n;s=0;n=200;for i=1:n; s=s+1/(i3*sin(i)2); plot(i,s,.) hold onend;4、syms s n;s=0;n=400;for i=1:n; s=s+1/(i3*sin(i)2); plot(i,s,.) hold onend; 4syms s n;s=0;n=400;for i=1:n; s=s+1/(i3*sin(i)2); plot(i,s,.) hold onend;
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1