[工学]Matlab实验报告湖南工大工程应用软件Matlab实验课

上传人:M****1 文档编号:402339779 上传时间:2023-06-19 格式:DOC 页数:41 大小:190.50KB
返回 下载 相关 举报
[工学]Matlab实验报告湖南工大工程应用软件Matlab实验课_第1页
第1页 / 共41页
[工学]Matlab实验报告湖南工大工程应用软件Matlab实验课_第2页
第2页 / 共41页
[工学]Matlab实验报告湖南工大工程应用软件Matlab实验课_第3页
第3页 / 共41页
[工学]Matlab实验报告湖南工大工程应用软件Matlab实验课_第4页
第4页 / 共41页
[工学]Matlab实验报告湖南工大工程应用软件Matlab实验课_第5页
第5页 / 共41页
点击查看更多>>
资源描述

《[工学]Matlab实验报告湖南工大工程应用软件Matlab实验课》由会员分享,可在线阅读,更多相关《[工学]Matlab实验报告湖南工大工程应用软件Matlab实验课(41页珍藏版)》请在金锄头文库上搜索。

1、实验一 x=1x = 1y=1 2 3 4 5 6 7 8 9 ;z1=1:10,z2=1:2:5;z1 = 1 2 3 4 5 6 7 8 9 10w=linspace(1,10,10); t1=ones(3),t2=ones(1,3),t3=ones(3,1)t1 = 1 1 1 1 1 1 1 1 1t2 = 1 1 1t3 = 1 1 1t4=zeros(3),t5=eye(4)t4 = 0 0 0 0 0 0 0 0 0t5 = 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1思考题(1)变量名必须以字母开头,并且只能有字母、数字、下划线等三类符号组成,不能含有空格和标

2、点符号等;变量名区分字母的大小写;变量名不能超过63个字符,超过的部分被忽略;关键字不能作为变量名;最好不要使用教材P22当中表2-1的特殊常量符号作为变量名。 (2)分号的作用:分隔不想显示计算结果的各个语句;矩阵行与行之间的分隔符; 冒号的作用:生成一维数值数组;表示一维数组的全部元素或者多维数组某一维的全部元素。 逗号的作用:分隔想要显示结果的各个语句;变量分隔符;矩阵一行中各个元素的分隔符。 (3)linspace是线性等分函数,格式为A=linspace(a1,an,n),其中a1是向量的首元素,an是尾元素,意义是把向量等分为n个元素。若省略n,则默认生成50个元素。 (4)one

3、s():全1矩阵; zeros():全0矩阵; eye():单位矩阵。a=ones(1,30)a = Columns 1 through 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 20 through 30 1 1 1 1 1 1 1 1 1 1 1format compact aa = Columns 1 through 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Columns 20 through 30 1 1 1 1 1 1 1 1 1 1 1format long pians = 3.141

4、59265358979 format short pians = 3.1416format long pians = 3.14159265358979 format + pians =+ -pians =- pi sin(pi)ans =+ sin(pi)ans =+ exist (pi)ans =+ pi=0; exist (pi)ans =+ pipi = clear pi exist (pi)ans =+结果分析:EXIST(A) returns: 0 if A does not exist 1 if A is a variable in the workspace 2 if A is

5、an M-file on MATLABs search path. It also returns 2 when A is the full pathname to a file or when A is the name of an ordinary file on MATLABs search path 3 if A is a MEX-file on MATLABs search path 4 if A is a MDL-file on MATLABs search path 5 if A is a built-in MATLAB function 6 if A is a P-file o

6、n MATLABs search path 7 if A is a directory 8 if A is a Java class 实验二A=2,3,4,5,6A = 2 3 4 5 6 B=1;2;3;4;5B = 1 2 3 4 5 A=1:2:10,B=1:10,C=10:-1:1A = 1 3 5 7 9B = 1 2 3 4 5 6 7 8 9 10C = 10 9 8 7 6 5 4 3 2 1A=linspace(1,10), B=linspace(1,30,30)A = Columns 1 through 11 1.0000 1.0909 1.1818 1.2727 1.36

7、36 1.4545 1.5455 1.6364 1.7273 1.8182 1.9091 Columns 12 through 22 2.0000 2.0909 2.1818 2.2727 2.3636 2.4545 2.5455 2.6364 2.7273 2.8182 2.9091 Columns 23 through 33 3.0000 3.0909 3.1818 3.2727 3.3636 3.4545 3.5455 3.6364 3.7273 3.8182 3.9091 Columns 34 through 44 4.0000 4.0909 4.1818 4.2727 4.3636

8、4.4545 4.5455 4.6364 4.7273 4.8182 4.9091 Columns 45 through 55 5.0000 5.0909 5.1818 5.2727 5.3636 5.4545 5.5455 5.6364 5.7273 5.8182 5.9091 Columns 56 through 66 6.0000 6.0909 6.1818 6.2727 6.3636 6.4545 6.5455 6.6364 6.7273 6.8182 6.9091 Columns 67 through 77 7.0000 7.0909 7.1818 7.2727 7.3636 7.4

9、545 7.5455 7.6364 7.7273 7.8182 7.9091 Columns 78 through 88 8.0000 8.0909 8.1818 8.2727 8.3636 8.4545 8.5455 8.6364 8.7273 8.8182 8.9091 Columns 89 through 99 9.0000 9.0909 9.1818 9.2727 9.3636 9.4545 9.5455 9.6364 9.7273 9.8182 9.9091 Column 100 10.0000B = Columns 1 through 19 1 2 3 4 5 6 7 8 9 10

10、 11 12 13 14 15 16 17 18 19 Columns 20 through 30 20 21 22 23 24 25 26 27 28 29 30A=logspace(0,4,5)A = 1 10 100 1000 10000练习:logspace(1,4*pi,10)ans = 1.0e+012 * 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0005 0.0099 0.1911 3.6844A=1 2 3 4 5,B=3:7,AT=A,BT=B,A = 1 2 3 4 5B = 3 4 5 6 7AT = 1 2 3 4 5BT = 3 4 5 6 7E1=A+B,E2=A-BE1 = 4 6 8 10 12E2 = -2

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号