matlab程序设计语言答案.doc
《matlab程序设计语言答案.doc》由会员分享,可在线阅读,更多相关《matlab程序设计语言答案.doc(45页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、一、 实验结果: 1、程序:3*3的单位阵:a=eye(3) a = 1 0 0 0 1 0 0 0 115*8的单位阵:a=eye(15,8)a = 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2、0 0 0 0 0 0 0 03*3的全1阵:a=ones(3)a = 1 1 1 1 1 1 1 1 115*8的全1 阵a=ones(15,8)a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
3、1 1 1 1 1 1 1 1 13*3的全0阵:a=zeros(3)a = 0 0 0 0 0 0 0 0 015*8的全0阵:a=zeros(15,8)a = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4、0 0 0 0 0 0 0 0 0 0 03*3的均匀分布随机阵(-1,1之间):r=2*rand(3,3)-1r = 0.6294 0.8268 -0.4430 0.8116 0.2647 0.0938 -0.7460 -0.8049 0.91503*3的正态分布随机阵(均值为1,方差为4):r=2*randn(3,3)+1r = 6.5389 2.4508 0.5901 -1.6998 0.8739 0.7517 7.0698 2.4295 3.979415*8的均匀分布随机阵(-1,1之间):r=2*rand(15,8)-1r = Columns 1 through 5 0.5844 -
5、0.9077 0.4187 0.3982 0.2321 0.9190 -0.8057 0.5094 0.7818 -0.0534 0.3115 0.6469 -0.4479 0.9186 -0.2967 -0.9286 0.3897 0.3594 0.0944 0.6617 0.6983 -0.3658 0.3102 -0.7228 0.1705 0.8680 0.9004 -0.6748 -0.7014 0.0994 0.3575 -0.9311 -0.7620 -0.4850 0.8344 0.5155 -0.1225 -0.0033 0.6814 -0.4283 0.4863 -0.23
6、69 0.9195 -0.4914 0.5144 -0.2155 0.5310 -0.3192 0.6286 0.5075 0.3110 0.5904 0.1705 -0.5130 -0.2391 -0.6576 -0.6263 -0.5524 0.8585 0.1356 0.4121 -0.0205 0.5025 -0.3000 -0.8483 -0.9363 -0.1088 -0.4898 -0.6068 -0.8921 -0.4462 0.2926 0.0119 -0.4978 0.0616 Columns 6 through 8 0.5583 0.3784 0.5498 0.8680
7、0.4963 0.6346 -0.7402 -0.0989 0.7374 0.1376 -0.8324 -0.8311 -0.0612 -0.5420 -0.2004 -0.9762 0.8267 -0.4803 -0.3258 -0.6952 0.6001 -0.6756 0.6516 -0.1372 0.5886 0.0767 0.8213 -0.3776 0.9923 -0.6363 0.0571 -0.8436 -0.4724 -0.6687 -0.1146 -0.7089 0.2040 -0.7867 -0.7279 -0.4741 0.9238 0.7386 0.3082 -0.9
8、907 0.159415*8的正态分布随机阵(均值为1,方差为4):r=2*randn(15,8)+1r = Columns 1 through 5 1.0670 2.0401 1.6151 -1.7234 2.6521 -1.6674 0.9599 -1.5142 1.9101 4.0540 3.2550 0.9305 -0.7309 -0.6974 1.9338 1.7004 -0.5963 0.6469 0.3302 0.5806 0.4019 3.0374 2.5828 2.1056 2.2504 1.0458 0.7336 -1.6640 3.0782 1.3665 0.4760 -
9、0.4291 -3.6597 -1.2353 -1.0595 -2.5004 3.7028 -1.8982 3.5213 2.8984 0.4287 0.5505 1.6670 2.3203 1.6141 -0.6627 -0.1781 1.7827 0.8643 1.2703 -0.9584 0.4125 1.9034 0.6096 2.0305 -1.3128 -0.6959 0.7394 0.5648 1.5228 -0.0671 -1.2403 1.3674 0.3938 -0.8830 -3.0053 6.0520 0.0477 1.0461 0.6753 2.9285 4.3110
10、 2.7240 1.1026 0.7079 Columns 6 through 8 -0.0640 0.1107 -1.1334 4.3642 0.6881 2.8675 -0.7515 1.5521 1.7006 0.0324 0.4777 0.9420 -0.4240 1.8868 1.3649 -1.3484 1.7838 -2.1301 0.6155 -1.5014 0.8309 0.4519 -0.8959 4.2079 4.0601 -0.4822 1.1967 0.5020 -0.0156 1.0827 -1.1284 0.3588 -0.4683 4.2069 1.0249 0
11、.9384 3.4694 -5.0584 1.4647 0.5407 0.0860 1.8528 -2.0123 3.4849 0.25442、a矩阵: v1=8 -7 2; v2=5 3; c=fliplr(diag(v1)+fliplr(diag(v2,-1)c = 0 0 8 0 -7 5 2 3 0b矩阵: v1=2 5 8; 4 5 7 v2=4 0 7; c=diag(v1)+fliplr(diag(v2)c = 2 0 4 0 5 0 7 0 83、a=5-round(100*rand(50,2)/10a = 2.3000 1.0000 4.6000 -1.2000 -1.700
12、0 3.5000 0.7000 1.2000 0.5000 3.4000 -1.1000 -2.6000 4.4000 -3.7000 1.8000 1.5000 -2.7000 -1.9000 -2.0000 2.1000 3.7000 -0.3000 3.7000 -3.3000 4.1000 -1.0000 4.9000 1.6000 0.8000 2.0000 -1.6000 0.5000 -2.2000 0.8000 -0.3000 1.4000 3.9000 -0.6000 -1.3000 -2.4000 3.7000 0.8000 3.7000 0.7000 4.0000 3.8
13、000 3.6000 4.8000 3.3000 2.1000 3.0000 1.8000 1.8000 -1.5000 1.8000 -4.6000 2.8000 -4.4000 2.5000 0.4000 -3.9000 2.6000 -2.0000 -2.6000 -0.6000 -2.6000 3.2000 -2.4000 2.9000 -2.4000 4.2000 3.9000 -4.1000 -1.8000 -2.1000 0.4000 -0.6000 2.9000 1.9000 4.0000 3.3000 -3.2000 -1.2000 3.2000 -4.9000 3.4000
14、 3.3000 -1.7000 2.4000 -3.9000 1.0000 -0.2000 4.3000 -2.0000 -1.8000 3.5000 1.0000 -4.5000 -4.8000 -0.40004、脚本:x=-pi:pi/180:piy1=sin(x)y2=cos(x)结果:x = Columns 1 through 5 -3.1416 -3.1241 -3.1067 -3.0892 -3.0718 Columns 6 through 10 -3.0543 -3.0369 -3.0194 -3.0020 -2.9845Columns 356 through 360 3.054
15、3 3.0718 3.0892 3.1067 3.1241 Column 361 3.1416 y1 = Columns 1 through 5 -0.0000 -0.0175 -0.0349 -0.0523 -0.0698 Columns 6 through 10Columns 356 through 360 0.0872 0.0698 0.0523 0.0349 0.0175 Column 3610.0000y2 = Columns 1 through 5 -1.0000 -0.9998 -0.9994 -0.9986 -0.9976 Columns 6 through 10 -0.996
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- matlab 程序设计语言 答案
限制150内