版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、>> a=1 2 3a = 1 2 3>> b=a'b = 1 2 3>> fliplr(a)ans = 3 2 1>> flipud(a)ans = 1 2 3>> rot90(a)ans = 3 2 1>> a=magic(3)a = 8 1 6 3 5 7 4 9 2>> help diagdiag - Get diagonal elements or create diagonal matrix This MATLAB function returns a square diagonal mat
2、rix with the elements of vector v on the main (k=0) diagonal. D = diag(v) D = diag(v,k) x = diag(A) x = diag(A,k) diag 的参考页 另请参阅 blkdiag, isdiag, istril, istriu, spdiags, tril, triu 名为 diag 的其他函数 fixedpoint/diag, robust/diag, symbolic/diag>> diag(a)ans = 8 5 2>> b=diag(a)b = 8 5 2>>
3、; diag(b)ans = 8 0 0 0 5 0 0 0 2>> %建立矩阵>> a=1:9a = 1 2 3 4 5 6 7 8 9>> reshape(a,3,3)ans = 1 4 7 2 5 8 3 6 9>> b=reshape(a,3,3)b = 1 4 7 2 5 8 3 6 9>> c=reshape(b,9,1)c = 1 2 3 4 5 6 7 8 9>> tral(a)未定义与 'double' 类型的输入参数相对应的函数 'tral'。 是不是想输入:>&g
4、t; tril(a)ans = 1 0 0 0 0 0 0 0 0>> inv(b)警告: 矩阵为奇异工作精度。 ans = Inf Inf Inf Inf Inf Inf Inf Inf Inf>> c=rand(3)c = 0.8147 0.9134 0.2785 0.9058 0.6324 0.5469 0.1270 0.0975 0.9575>> inv(c)ans = -1.9958 3.0630 -1.1690 2.8839 -2.6919 0.6987 -0.0291 -0.1320 1.1282>> %求矩阵的逆>>
5、a=1 2; 3 4 a=1 2; 3 4 |错误: 圆括号或方括号不对称或异常。 >> a=1 2; 3 4a = 1 2 3 4>> a=1 2 3;4 5 6;7 8 9a = 1 2 3 4 5 6 7 8 9>> a.* a.* |错误: 表达式或语句不完整或不正确。 >> a.*aans = 1 4 9 16 25 36 49 64 81>> b=1 2; 3 4b = 1 2 3 4>> a*b错误使用 * 内部矩阵维度必须一致。 >> b=1 2 5; 3 4 6b = 1 2 5 3 4 6&
6、gt;> b=1 2; 5 3;4 6b = 1 2 5 3 4 6>> a*bans = 23 26 53 59 83 92>> a.*b错误使用 .* 矩阵维度必须一致。 >> b=a>5b = 0 0 0 0 0 1 1 1 1>> %逻辑运算符>> b=ab = 1 2 3 4 5 6 7 8 9>> a&bans = 1 1 1 1 1 1 1 1 1>> aans = 0 0 0 0 0 0 0 0 0>> b=a>5b = 0 0 0 0 0 1 1 1 1&
7、gt;> a&bans = 0 0 0 0 0 1 1 1 1>> a|bans = 1 1 1 1 1 1 1 1 1>> bans = 1 1 1 1 1 0 0 0 0>> t=1:1:10t = 1 2 3 4 5 6 7 8 9 10>> y=sin(t)y = 0.8415 0.9093 0.1411 -0.7568 -0.9589 -0.2794 0.6570 0.9894 0.4121 -0.5440>> plot(t,y)>> t=0:0.1:2*pi;>> x1=sin(t);
8、>> plot(t,x1)>> y=asin(x1)y = Columns 1 through 12 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 1.0000 1.1000 Columns 13 through 24 1.2000 1.3000 1.4000 1.5000 1.5416 1.4416 1.3416 1.2416 1.1416 1.0416 0.9416 0.8416 Columns 25 through 36 0.7416 0.6416 0.5416 0.4416 0.
9、3416 0.2416 0.1416 0.0416 -0.0584 -0.1584 -0.2584 -0.3584 Columns 37 through 48 -0.4584 -0.5584 -0.6584 -0.7584 -0.8584 -0.9584 -1.0584 -1.1584 -1.2584 -1.3584 -1.4584 -1.5584 Columns 49 through 60 -1.4832 -1.3832 -1.2832 -1.1832 -1.0832 -0.9832 -0.8832 -0.7832 -0.6832 -0.5832 -0.4832 -0.3832 Column
10、s 61 through 63 -0.2832 -0.1832 -0.0832>> figure;plot(t,y)>> t=0:0.1:2*pi;>> t=-pi:0.1:pi;>> x1=sin(t);>> plot(t,x1)>> y=asin(x1);>> figure;plot(t,y)>> t=-pi/2:0.1:pi/2;>> x1=sin(t);plot(t,x1)y=asin(x1);figure;plot(t,y)>> t=-pi:0.1:pi;>&
11、gt; exp(1)ans = 2.7183>> exp(j*pi/4)ans = 0.7071 + 0.7071i>> power(2,3)ans = 8>> power(3,2)ans = 9>> pow2(a)ans = 2 4 8 16 32 64 128 256 512>> nextpow2(15)ans = 4>> nextpow2(31)ans = 5>> nextpow2(314444)ans = 19>> nextpow2(31445)ans = 15>> nextpo
12、w2(314445)ans = 19>> nextpow2(314645)ans = 19>> power(2,19)ans = 524288>> x=314444x = 314444>> power(2,19)-xans = 209844>> log2(10)ans = 3.3219>> log10(10)ans = 1>> 10*log10(20 10*log10(20 |错误: 表达式或语句不正确-可能 (、 或 不对称。 >> 10*log10(2)ans = 3.0103>>
13、20*log10(50.5)ans = 6.9897>> 20*log10(1/20.5)ans = -3.0103>> %50.5 ; sqrt(5) ; sqrtm(5)>>>> a=1 2 3 4 a = 1 2 3 4>> roots(a)ans = -1.6506 + 0.0000i -0.1747 + 1.5469i -0.1747 - 1.5469i>> %X3+2*x2+3*x1+4=0>> real(roots_a)未定义函数或变量 'roots_a'。 是不是想输入:>
14、> real(roots)错误使用 roots (line 22)输入参数的数目不足。 >> r=roots(a)r = -1.6506 + 0.0000i -0.1747 + 1.5469i -0.1747 - 1.5469i>> real(r)ans = -1.6506 -0.1747 -0.1747>> ads(r)未定义与 'double' 类型的输入参数相对应的函数 'ads'。 >> abs(r)ans = 1.6506 1.5567 1.5567>> t=0:0.1:7;>&g
15、t; x=2*atan(tan(t);>> plot(t,y)未定义函数或变量 'y'。 >> plot(t,x)>> hold on>> phase=unwrap(x)phase = Columns 1 through 12 0 0.2000 0.4000 0.6000 0.8000 1.0000 1.2000 1.4000 1.6000 1.8000 2.0000 2.2000 Columns 13 through 24 2.4000 2.6000 2.8000 3.0000 3.2000 3.4000 3.6000 3.80
16、00 4.0000 4.2000 4.4000 4.6000 Columns 25 through 36 4.8000 5.0000 5.2000 5.4000 5.6000 5.8000 6.0000 6.2000 6.4000 6.6000 6.8000 7.0000 Columns 37 through 48 7.2000 7.4000 7.6000 7.8000 8.0000 8.2000 8.4000 8.6000 8.8000 9.0000 9.2000 9.4000 Columns 49 through 60 9.6000 9.8000 10.0000 10.2000 10.40
17、00 10.6000 10.8000 11.0000 11.2000 11.4000 11.6000 11.8000 Columns 61 through 71 12.0000 12.2000 12.4000 12.6000 12.8000 13.0000 13.2000 13.4000 13.6000 13.8000 14.0000>> plot(t,phase,"'r') plot(t,phase,"'r') |错误: 输入字符不是 MATLAB 语句或表达式中的有效字符。 >> plot(t,phase,'
18、;r')>> %解卷绕 unwrap>> round(3.213)ans = 3>> round(3.913)ans = 4>> fix(2.1345)ans = 2>> floor(2.5678)ans = 2>> ceil(3.4441)ans = 4>> %floor 向下取整 ceil向上取整>> sign(2.345)ans = 1>> sign(-23)ans = -1>> rem(2.3)错误使用 rem输入参数的数目不足。 >> rem(4
19、,3)ans = 1>> mod(2)错误使用 mod输入参数的数目不足。 >> mod(16,5)ans = 1>> mod(-4,5) mod(-4,5) |错误: 输入字符不是 MATLAB 语句或表达式中的有效字符。 >> mod(-4,5) mod(-4,5) |错误: 输入字符不是 MATLAB 语句或表达式中的有效字符。 >> mod(-4,5)ans = 1>> y=2 34 5 2 6 15 7 ;>> plot(y)>> plot(y)>> t=linespace(0
20、,2*pi)未定义与 'double' 类型的输入参数相对应的函数 'linespace'。 是不是想输入:>> t=linspace(0,2*pi)t = Columns 1 through 12 0 0.0635 0.1269 0.1904 0.2539 0.3173 0.3808 0.4443 0.5077 0.5712 0.6347 0.6981 Columns 13 through 24 0.7616 0.8251 0.8885 0.9520 1.0155 1.0789 1.1424 1.2059 1.2693 1.3328 1.3963
21、1.4597 Columns 25 through 36 1.5232 1.5867 1.6501 1.7136 1.7771 1.8405 1.9040 1.9675 2.0309 2.0944 2.1579 2.2213 Columns 37 through 48 2.2848 2.3483 2.4117 2.4752 2.5387 2.6021 2.6656 2.7291 2.7925 2.8560 2.9195 2.9829 Columns 49 through 60 3.0464 3.1099 3.1733 3.2368 3.3003 3.3637 3.4272 3.4907 3.5
22、541 3.6176 3.6811 3.7445 Columns 61 through 72 3.8080 3.8715 3.9349 3.9984 4.0619 4.1253 4.1888 4.2523 4.3157 4.3792 4.4427 4.5061 Columns 73 through 84 4.5696 4.6331 4.6965 4.7600 4.8235 4.8869 4.9504 5.0139 5.0773 5.1408 5.2043 5.2677 Columns 85 through 96 5.3312 5.3947 5.4581 5.5216 5.5851 5.6485
23、 5.7120 5.7755 5.8389 5.9024 5.9659 6.0293 Columns 97 through 100 6.0928 6.1563 6.2197 6.2832>> x=exp(j*t)x = Columns 1 through 6 1.0000 + 0.0000i 0.9980 + 0.0634i 0.9920 + 0.1266i 0.9819 + 0.1893i 0.9679 + 0.2511i 0.9501 + 0.3120i Columns 7 through 12 0.9284 + 0.3717i 0.9029 + 0.4298i 0.8738
24、+ 0.4862i 0.8413 + 0.5406i 0.8053 + 0.5929i 0.7660 + 0.6428i Columns 13 through 18 0.7237 + 0.6901i 0.6785 + 0.7346i 0.6306 + 0.7761i 0.5801 + 0.8146i 0.5272 + 0.8497i 0.4723 + 0.8815i Columns 19 through 24 0.4154 + 0.9096i 0.3569 + 0.9341i 0.2969 + 0.9549i 0.2358 + 0.9718i 0.1736 + 0.9848i 0.1108 +
25、 0.9938i Columns 25 through 30 0.0476 + 0.9989i -0.0159 + 0.9999i -0.0792 + 0.9969i -0.1423 + 0.9898i -0.2048 + 0.9788i -0.2665 + 0.9638i Columns 31 through 36 -0.3271 + 0.9450i -0.3863 + 0.9224i -0.4441 + 0.8960i -0.5000 + 0.8660i -0.5539 + 0.8326i -0.6056 + 0.7958i Columns 37 through 42 -0.6549 +
26、0.7557i -0.7015 + 0.7127i -0.7453 + 0.6668i -0.7861 + 0.6182i -0.8237 + 0.5671i -0.8580 + 0.5137i Columns 43 through 48 -0.8888 + 0.4582i -0.9161 + 0.4009i -0.9397 + 0.3420i -0.9595 + 0.2817i -0.9754 + 0.2203i -0.9874 + 0.1580i Columns 49 through 54 -0.9955 + 0.0951i -0.9995 + 0.0317i -0.9995 - 0.03
27、17i -0.9955 - 0.0951i -0.9874 - 0.1580i -0.9754 - 0.2203i Columns 55 through 60 -0.9595 - 0.2817i -0.9397 - 0.3420i -0.9161 - 0.4009i -0.8888 - 0.4582i -0.8580 - 0.5137i -0.8237 - 0.5671i Columns 61 through 66 -0.7861 - 0.6182i -0.7453 - 0.6668i -0.7015 - 0.7127i -0.6549 - 0.7557i -0.6056 - 0.7958i
28、-0.5539 - 0.8326i Columns 67 through 72 -0.5000 - 0.8660i -0.4441 - 0.8960i -0.3863 - 0.9224i -0.3271 - 0.9450i -0.2665 - 0.9638i -0.2048 - 0.9788i Columns 73 through 78 -0.1423 - 0.9898i -0.0792 - 0.9969i -0.0159 - 0.9999i 0.0476 - 0.9989i 0.1108 - 0.9938i 0.1736 - 0.9848i Columns 79 through 84 0.2
29、358 - 0.9718i 0.2969 - 0.9549i 0.3569 - 0.9341i 0.4154 - 0.9096i 0.4723 - 0.8815i 0.5272 - 0.8497i Columns 85 through 90 0.5801 - 0.8146i 0.6306 - 0.7761i 0.6785 - 0.7346i 0.7237 - 0.6901i 0.7660 - 0.6428i 0.8053 - 0.5929i Columns 91 through 96 0.8413 - 0.5406i 0.8738 - 0.4862i 0.9029 - 0.4298i 0.92
30、84 - 0.3717i 0.9501 - 0.3120i 0.9679 - 0.2511i Columns 97 through 100 0.9819 - 0.1893i 0.9920 - 0.1266i 0.9980 - 0.0634i 1.0000 - 0.0000i>> plot(x)>>>> n=1:20n = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20>> x1=0:8;>> x=x1'*ones(1,20)+rand(9,20);>> x=x1
31、'*ones(1,20);>> x=x1'*ones(1,20);>> x=x1'*ones(1,20)x = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5
32、5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8>> ones(1,20)ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1>> x=x1'*ones(1,20)+rand(9,20);>> h=plot(n,x)h = 174.0068 175.0063 176.0063 177.0
33、063 178.0063 179.0063 180.0063 181.0063 182.0063>> figure:plot(x)ans = Columns 1 through 20 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 Columns 21 through 40 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 Columns 41 through 60 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 5
34、7 58 59 60 61 Columns 61 through 80 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 Columns 81 through 100 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 Columns 101 through 120 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 Columns 121 thr
35、ough 140 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 Columns 141 through 160 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 Columns 161 through 180 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 Columns 181 through 200 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 Columns 201 through 220 202 203 204 205 206 207 208 209 210 211 212 213 214 215
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 高中信息技术必修一《算法与程序设计》单元复习教学设计
- 小学四年级英语寒假自学教案:冀教版三起新教材Unit 1课本知识预习与巩固练习
- 青岛六区教师招聘考试题及答案
- 学术论文质量评价实施细节
- 2026小学生物教资面试结构化题库及解析
- 九年级化学《运动的水分子》专题复习教学设计
- 高中政治必修一 第四课 坚持和发展中国特色社会主义实现中华民族伟大复兴 单元复习教学设计
- �沪科版九年级物理内能与热机单元教学设计
- 高中信息技术必修1 教学设计:数据编码与进制转换核心素养培育
- 小学一年级劳动课打发奶油装入裱花袋教学设计
- 电气控制与PLC应用-基于S7-1200 PLC(第2版)
- 云南铝业股份有限公司招聘笔试题库2026
- 吉利汽车生产安全管理制度
- 2026洛阳钼业招聘面试题及答案
- 电玩城转让合同范本
- 2025年河北雄安新区公开招聘社区工作者62名笔试考试参考试题及答案解析
- 产业园区合作共建协议5篇
- 稳定性与鲁棒性lecture4-5-线性鲁棒控制系统设计I
- (完整版)《安全生产法》试题及答案
- 《云南省城镇燃气安全排查整治手册(试行)》
- 卵巢肿瘤个案护理
评论
0/150
提交评论