1、数学实验matlab版答案数学实验matlab版答案【篇一:matlab数学实验习题全部答案(胡良剑)】ge20,ex1 (5) 等于exp(1),exp(2);exp(3),exp(4) (7) 3=1*3, 8=2*4 (8) a为各列最小值,b为最小值所在的行号 (10) 1=4,false, 2=3,false, 3=2, ture, 4=1,ture (11) 答案表明:编址第2元素满足不等式(30=20)和编址第4元素满足不等式(40=10) (12) 答案表明:编址第2行第1列元素满足不等式(30=20)和编址第2行第2列元素满足不等式(40=10) %page20, ex2 (
2、1)a, b, c的值尽管都是1, 但数据类型分别为数值,字符, 逻辑, 注意a与c相等, 但他们不等于b (2)double(fun)输出的分别是字符a,b,s,(,x,)的ascii码 %page20,ex3 r=2;p=0.5;n=12; t=log(r)/n/log(1+0.01*p) t = 11.5813 %page20,ex4 x=-2:0.05:2;f=x.4-2.x; fmin,min_index=min(f) fmin = -1.3907 %最小值 min_index = 54 %最小值点编址 x(min_index) ans = 0.6500 %最小值点 f1,x1_in
3、dex=min(abs(f) %求近似根-绝对值最小的点 f1 = 0.0328 x1_index = 24 x(x1_index) ans = -0.8500 x(x1_index)=;f=x.4-2.x; %删去绝对值最小的点以求函数绝对值次小的点 f2,x2_index=min(abs(f) %求另一近似根-函数绝对值次小的点 f2 = 0.0630 x2_index = 65 1 x(x2_index) ans = 1.2500 %page20,ex5 z=magic(10) z = 92 99 1 8 15 67 74 51 58 40 98 80 7 14 16 73 55 57
4、64 41 4 81 88 20 22 54 56 63 70 47 85 87 19 21 3 60 62 69 71 28 86 93 25 2 9 61 68 75 52 34 17 24 76 83 90 42 49 26 33 65 23 5 82 89 91 48 30 32 39 66 79 6 13 95 97 29 31 38 45 72 10 12 94 96 78 35 37 44 46 53 11 18 100 77 84 36 43 50 27 59 sum(z) ans = 505 505 505 505 505 505 505 505 505 505 sum(di
5、ag(z) ans = 505 z(:,2)/sqrt(3) ans = 57.1577 46.1880 46.7654 50.2295 53.6936 13.8564 2.8868 3.4641 6.9282 10.3923 z(8,:)=z(8,:)+z(3,:) z = 92 99 1 8 15 67 74 51 58 40 98 80 7 14 16 73 55 57 64 41 4 81 88 20 22 54 56 63 70 47 85 87 19 21 3 60 62 69 71 28 86 93 25 2 9 61 68 75 52 34 17 24 76 83 90 42
6、49 26 33 65 23 5 82 89 91 48 30 32 39 66 283 87 101 115 119 83 87 101 115 119 10 12 94 96 78 35 37 44 46 53 11 18 100 77 84 36 43 50 27 59 3 %page 40 ex1 先在编辑器窗口写下列m函数,保存为eg2_1.m function xbar,s=ex2_1(x) n=length(x); xbar=sum(x)/n; s=sqrt(sum(x.2)-n*xbar2)/(n-1); 例如 x=81 70 65 51 76 66 90 87 61 77;
7、xbar,s=ex2_1(x) xbar = 72.4000 s = 12.1124 %page 40 ex2 s=log(1);n=0; while s=100 n=n+1; s=s+log(1+n); end m=n 计算结果m=37 %page 40 ex3 clear; f(1)=1;f(2)=1;k=2;x=0; e=1e-8; a=(1+sqrt(5)/2; while abs(x-a)e k=k+1;f(k)=f(k-1)+f(k-2); x=f(k)/f(k-1); end a,x,k 计算至k=21可满足精度 %page 40 ex4 clear;tic;s=0; for i
8、=1:1000000 s=s+sqrt(3)/2i; end s,toc tic;s=0;i=1; while i=1000000 s=s+sqrt(3)/2i;i=i+1; 4end s,toc tic;s=0; i=1:1000000; s=sqrt(3)*sum(1./2.i); s,toc %page 40 ex5 t=0:24; c=15 14 14 14 14 15 16 18 20 22 23 25 28 . 31 32 31 29 27 25 24 22 20 18 17 16; plot(t,c) %page 40 ex6 %(1) x=-2:0.1:2;y=x.2.*sin
9、(x.2-x-2);plot(x,y) y=inline(x2*sin(x2-x-2);fplot(y,-2 2) %(2)参数方法 t=linspace(0,2*pi,100); x=2*cos(t);y=3*sin(t); plot(x,y) %(3) x=-3:0.1:3;y=x; x,y=meshgrid(x,y); z=x.2+y.2; surf(x,y,z) %(4) x=-3:0.1:3;y=-3:0.1:13; x,y=meshgrid(x,y); z=x.4+3*x.2+y.2-2*x-2*y-2*x.2.*y+6; surf(x,y,z) %(5) t=0:0.01:2*p
10、i; x=sin(t);y=cos(t);z=cos(2*t); plot3(x,y,z) %(6) theta=linspace(0,2*pi,50);fai=linspace(0,pi/2,20); theta,fai=meshgrid(theta,fai); x=2*sin(fai).*cos(theta); 5【篇二:matlab数学实验答案】(5) 等于exp(1),exp(2);exp(3),exp(4) (7) 3=1*3, 8=2*4 (8) a为各列最小值,b为最小值所在的行号 (10) 1=4,false, 2=3,false, 3=2, ture, 4=1,ture (1
11、1) 答案表明:编址第2元素满足不等式(30=20)和编址第4元素满足不等式(40=10) (12) 答案表明:编址第2行第1列元素满足不等式(30=20)和编址第2行第2列元素满足不等式(40=10) %page20, ex2 (1)a, b, c的值尽管都是1, 但数据类型分别为数值,字符, 逻辑, 注意a与c相等,他们不等于b (2)double(fun)输出的分别是字符a,b,s,(,x,)的ascii码 %page20,ex3 r=2;p=0.5;n=12; t=log(r)/n/log(1+0.01*p) t = 11.5813 %page20,ex4 x=-2:0.05:2;f=
12、x.4-2.x; fmin,min_index=min(f) fmin = -1.3907 %最小值 min_index = 54 %最小值点编址 x(min_index) ans = 0.6500 %最小值点 f1,x1_index=min(abs(f) %求近似根-绝对值最小的点 f1 = 0.0328 x1_index = 24 x(x1_index) ans = -0.8500 x(x1_index)=;f=x.4-2.x; %删去绝对值最小的点以求函数绝对值次小的点 f2,x2_index=min(abs(f) %求另一近似根-函数绝对值次小的点 f2 = 0.0630 x2_ind
13、ex = 65 但 x(x2_index) ans = 1.2500 %page20,ex5 z=magic(10) z = 92 99 1 8 15 67 74 51 58 40 98 80 7 14 16 73 55 57 64 41 4 81 88 20 22 54 56 63 70 47 85 87 19 21 3 60 62 69 71 28 86 93 25 2 9 61 68 75 52 34 17 24 76 83 90 42 49 26 33 65 23 5 82 89 91 48 30 32 39 66 79 6 13 95 97 29 31 38 45 72 10 12
14、94 96 78 35 37 44 46 53 11 18 100 77 84 36 43 50 27 59 sum(z) ans = 505 505 505 505 505 505 505 505 505 505 sum(diag(z) ans = 505 z(:,2)/sqrt(3) ans = 57.1577 46.1880 46.7654 50.2295 53.6936 13.8564 2.8868 3.4641 6.9282 10.3923 z(8,:)=z(8,:)+z(3,:) z = 92 99 1 8 15 67 74 51 58 40 98 80 7 14 16 73 55
15、 57 64 41 4 81 88 20 22 54 56 63 70 47 85 87 19 21 3 60 62 69 71 28 86 93 25 2 9 61 68 75 52 34 17 24 76 83 90 42 49 26 33 65 23 5 82 89 91 48 30 32 39 6683 87 101 115 119 83 87 101 115 119 10 12 94 96 78 35 37 44 46 53 11 18 100 77 84 36 43 50 27 59%page 40 ex1 先在编辑器窗口写下列m函数,保存为eg2_1.m function xba
16、r,s=ex2_1(x) n=length(x); xbar=sum(x)/n; 例如 x=81 70 65 51 76 66 90 87 61 77; xbar,s=ex2_1(x) xbar = 72.4000 s = 12.1124 %page 40 ex2 s=log(1);n=0; while s=100 n=n+1; s=s+log(1+n); end m=n 计算结果m=37 %page 40 ex3 clear; f(1)=1;f(2)=1;k=2;x=0; e=1e-8; a=(1+sqrt(5)/2; while abs(x-a)e k=k+1;f(k)=f(k-1)+f(
17、k-2); x=f(k)/f(k-1); end a,x,k 计算至k=21可满足精度 %page 40 ex4 clear;tic;s=0; for i=1:1000000 s=s+sqrt(3)/2i; end s,toc tic;s=0;i=1; while i=1000000 s=s+sqrt(3)/2i;i=i+1;end s,toc tic;s=0; i=1:1000000; s=sqrt(3)*sum(1./2.i); s,toc %page 40 ex5 t=0:24; c=15 14 14 14 14 15 16 18 20 22 23 25 28 . 31 32 31 29
18、 27 25 24 22 20 18 17 16; plot(t,c) %page 40 ex6 %(1) x=-2:0.1:2;y=x.2.*sin(x.2-x-2);plot(x,y) y=inline(x2*sin(x2-x-2);fplot(y,-2 2) %(2)参数方法 t=linspace(0,2*pi,100); x=2*cos(t);y=3*sin(t); plot(x,y) %(3) x=-3:0.1:3;y=x; x,y=meshgrid(x,y); z=x.2+y.2; surf(x,y,z) %(4) x=-3:0.1:3;y=-3:0.1:13; x,y=meshg
19、rid(x,y); z=x.4+3*x.2+y.2-2*x-2*y-2*x.2.*y+6; surf(x,y,z) %(5) t=0:0.01:2*pi; x=sin(t);y=cos(t);z=cos(2*t); plot3(x,y,z) %(6) theta=linspace(0,2*pi,50);fai=linspace(0,pi/2,20); theta,fai=meshgrid(theta,fai); x=2*sin(fai).*cos(theta);【篇三:matlab数学实验报告】与光照 浅析matlab中花瓶图片的做法 matlab程序设计教程期中考试作业 班级:数学系11级a
20、班 姓名:王佳荣 姓名:20111611104数学实验报告 实验序号: 日期:2014 年 05 月 05 日When you are old and grey and full of sleep,And nodding by the fire, take down this book,And slowly read, and dream of the soft lookYour eyes had once, and of their shadows deep;How many loved your moments of glad grace,And loved your beauty wit
21、h love false or true,But one man loved the pilgrim soul in you,And loved the sorrows of your changing face;And bending down beside the glowing bars,Murmur, a little sadly, how love fledAnd paced upon the mountains overheadAnd hid his face amid a crowd of stars.The furthest distance in the worldIs no
22、t between life and deathBut when I stand in front of youYet you dont know thatI love you.The furthest distance in the worldIs not when I stand in front of youYet you cant see my loveBut when undoubtedly knowing the love from bothYet cannot be together.The furthest distance in the worldIs not being apart while being in loveBut when I plainly cannot resist the yearningYet pretending you have never been in my heart.The furthest distance in the worldIs not struggling against the tidesBut using ones indifferent heartTo dig an uncrossable riverFor the one who loves you.
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2