ImageVerifierCode 换一换
格式:DOCX , 页数:102 ,大小:152.61KB ,
资源ID:20905447      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/20905447.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(Matlab知识总结Word格式文档下载.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

Matlab知识总结Word格式文档下载.docx

1、edit fun.medit file.extedit fun1 fun2 fun3 .edit classname/funedit private/funedit classname/private/funedit +packagename/classname/funedit(my file.m)Descriptionedit opens a new editor window.edit fun.m opens the file fun.m in the default editor. The fun.m file specification can include a partial pa

2、th, complete path, relative path, or no path. Be aware of the following: If you do not specify a path, the current folder is the default.If you specify a path, the folder must exist; otherwise MATLAB returns an error.If you specify a path and the folder exits, but the specified file does not, a prom

3、pt opens such as shown in the following image:To create a blank file named fun.m in the specified folder, click Yes. To suppress the prompt, select Do not show this prompt again. To reinstate the prompt after suppressing it, open the Preferences dialog box by selecting File Preferences General Confi

4、rmation Dialogs and then selecting Prompt when editing files that do not exist in the pane on the right.edit file.ext opens the specified file.edit fun1 fun2 fun3 . opens fun1.m, fun2.m, fun3.m, and so on, in the default editor.edit classname/fun, or edit private/fun, or edit classname/private/fun o

5、pens a method, private function, or private method for the named class.edit +packagename/classname/fun opens a method for the named class in the named package.) opens the file my file.m in the default editor. This form of the edit function is useful when a file name contains a space; you cannot use

6、the command form in such a case.2、命令输入的几个实用方法a、利用tab按键 输入命令的前几个字符,接着连按两下tab键,出现函数列表b、利用键盘上的上下方向键,调出历史命令c、当matlab按顺序执行很多命令时,可将要运行的大量命令统一存放在一个文本文件里,扩展名为.m,然后在命令窗口键入这个文件名,回车,matlab就会一次性地执行这些命令3、matlab保留常数Ans eps:当前计算机的零阈值i和f :若i和f值不被改写,则它们代表虚数单位,使用前,应确定它们没有被改写。恢复变量:i=sqrt(-1)。Inf :无穷大,负无穷用-inf表示NaN :非数

7、(not a number)Nargin :函数输入的变量的实际个数Nargout :函数输出变量的实际个数Pi :圆周率4、变量命名规则 首个字符必须是字母,并且后面字符不能包含空格、标点和括号。Matlab中大小写字符表示的含义不同5、数据类型结构 利用help datatype查看所有的数据类型基本类型常用的:数值型:双精度、浮点数,其matlab表示为double逻辑型:只包含1,0。1为true,0为false字符型:赋值时,字符串是用单引号括起来的单元数据clear all %清除计算机内存所保存的变量和函数who %查看当前内存里的变量名whos %查看当前内存里变量的详细说明c

8、lc %清屏注:命令行结尾加上一个分号表示不屏显结果,只运行命令。矩阵1、 基本规则a、 矩阵元素必须在中括号内b、 同行元素之间用空格或逗号隔开c、 行与行之间可以用分号或回车隔开d、 如果矩阵的某行过长,可以在续行符后另起一行接着输入2、 矩阵函数Ones :生成元素全为1的矩阵,ones(n)将生成n*n的矩阵Zeros :生成元素全为0的矩阵Nan :生成元素全为nan的矩阵Rand :生成在0,1区间均匀分布的随机矩阵Randn :生成均值为0,方差为1的标注正态分布随机矩阵Eye :生成单位矩阵,主对角线元素全为1Linspace :生成等间隔的行向量,其调用格式为:linspac

9、e(a,b,n),其中a和b是生成向量的第一个和最后一个元素,n是元素总数Magic :魔方矩阵3、矩阵运算+ - * /(右除) (左除) (乘方) (转置)a、点运算 点运算符号有.* ./ . . 两矩阵进行点运算是指对它们的对应元素进行相关运算,要求两个矩阵的维数相同b、关系运算 = = =(等于) =(不等于) 运算规则(1)当对象为两个标量,则直接比较大小关系,成立结果为1,否则为0(2)当参与比较的是两个维数相同的矩阵时,比较是对两个矩阵相同位置的元素按标量关系运算规则逐个进行,结果为一个维数与原矩阵相同的矩阵,元素由0或1组成(3)当一个是标量,一个是矩阵时,则把标量与矩阵的每

10、一个元素按标量关系运算规则逐个比较,并给出一个维数与原矩阵相同的矩阵,由0或1组成C、逻辑运算&(与) |(或) (非)d、冒号操作b=-3:2 %生成间隔为1的向量c=130:-2.4:115 %中间可以指定任意间隔d=a(:,3) %提取矩阵a的第3列元素,并转置后赋值给变量dE、矩阵的维数a= 1 2 3 4 7 8 9 10 3 4 6 9 5 7 10 11s1,s2=size(a) %将矩阵a的每一维的长度赋值给s1和s2 S1=4 s2=4b1=length(b) %向量b的长度 b=-3 -2 -1 0 1 2 b1= 6ndims(a) %直接得到a的维数 Ans=2f、空矩

11、阵的应用空矩阵的表示a(3,:)= %删除矩阵a的第3行h、矩阵的翻转(1)利用撇号可以实现矩阵的行列互换(2)fliplr(a) %将矩阵a左右翻转,第一列变成最后一列,以此类推flipud(a) %将矩阵a上下翻转,第一行变成最后一行,以此类推rot90(a) %将矩阵a逆时针旋转90度Rot90(a,k) :将矩阵a逆时针旋转k倍的90度,k为1可省略g、矩阵的拼接 b=a ones(3,6)*2;nan(size(a) a-1k、基本函数操作 help elfun和help matfun可以查看基本的数学函数和线性代数运算函数列表sum(a) %对矩阵a的每一列求和sum(a(:);

12、%对矩阵a的全部元素求和 a(:)将矩阵a变成向量a补充:type +文件名 %查看当期文件目录下的内容 利用mat文件可以将当前matlab工作空间中的一些有用的变量长久地保留下来,扩展名为.mat,mat文件生成和装入用save和load命令完成 常用格式: Save 文件名变量名表-append-ascii load 文件名变量名表-asciisave wps %保存为wps.mat文件ls wps.matload wps %装入mat文件save wps x y %只保存x y变量load wps x % 只装入x变量help tic/toc %时间机器 取整函数: fix floor

13、 ceil roundfix(1.2)=1 fix(2.3)=2 靠近0取整floor(1.2)=1 floor(-1.2)=2 靠近负无穷取整ceil(1.2)=2 ceil(-1.2)=-1 靠近正无穷取整round(1.2)=1 round(1.6)=2 四舍五入 a= 1 2 3;4 5 6a(end,end)ans=6a(end-1,end) ans=2Matlab指令及函数总结logical Convert numeric values to logical K = logical(A)K = logical(A) returns an array that can be used

14、 for logical indexing or logical tests.ExamplesGiven A = 1 2 3; 4 5 6; 7 8 9, the statement B = logical(eye(3) returns a logical arrayB = 1 0 0 0 1 0 0 0 1which can be used in logical indexing that returns As diagonal elements:A(B)ans = 1 5 9However, attempting to index into A using the numeric arra

15、y eye(3) results in:A(eye(3)? Subscript indices must either be real positive integers or logicals.ndimsNumber of array dimensionsn = ndims(A)n = ndims(A) returns the number of dimensions in the array A. The number of dimensions in an array is always greater than or equal to 2. Trailing singleton dim

16、ensions are ignored. A singleton dimension is any dimension for which size(A,dim) = 1.Algorithmsndims(x) is length(size(x).sizeArray dimensionsd = size(X)m,n = size(X)m = size(X,dim)d1,d2,d3,.,dn = size(X),d = size(X) returns the sizes of each dimension of array X in a vector d with ndims(X) element

17、s. If X is a scalar, which MATLAB software regards as a 1-by-1 array, size(X) returns the vector 1 1.m,n = size(X) returns the size of matrix X in separate variables m and n.m = size(X,dim) returns the size of the dimension of X specified by scalar dim.d1,d2,d3,.,dn = size(X), for n 1, returns the s

18、izes of the dimensions of the array X in the variables d1,d2,d3,.,dn, provided the number of output arguments n equals ndims(X). If n does not equal ndims(X), the following exceptions hold:n ndims(X), the variables all represent singleton dimensions:d1,d2,d3,d4,d5,d6 = size(X)d4 = d5 = d6 = 1 1 1len

19、gthLength of vector or largest array dimensionnumberOfElements = length(array)numberOfElements = length(array) finds the number of elements along the largest dimension of an array. array is an array of any MATLAB data type and any valid dimensions. numberOfElements is a whole number of the MATLAB do

20、uble class.For nonempty arrays, numberOfElements is equivalent to max(size(array). For empty arrays, numberOfElements is zero.Create a 1-by-8 array X and use length to find the number of elements in the second (largest) dimension:X = 5, 3.4, 72, 28/4, 3.61, 17 94 89;length(X) 8Create a 4-dimensional

21、 array Y in which the third dimension is the largest. Use length to find the number of elements in that dimension:Y = rand(2, 5, 17, 13);length(Y) 17Create a struct array S with character and numeric fields of different lengths. Use the structfun function to apply length to each field of S:S = struc

22、t(f1, Name:f2Charlie, . f3DOB:f4, 1917)S = f1: f2: f3: f4: 1917structfun(field)length(field), S) 7numelNumber of elements in array or subscripted array expressionn = numel(A)n = numel(A, index1, index2, . indexn)n = numel(A) returns the number of elements, n, in array A.n = numel(A, index1, index2,

23、. indexn) returns the number of subscripted elements, n, in A(index1, index2, ., indexn). To handle the variable number of arguments, numel is typically written with the header function n = numel(A, varargin), where varargin is a cell array with elements index1, index2, . indexn.The MATLAB software

24、implicitly calls the numel built-in function whenever an expression generates a comma-separated list. This includes brace indexing (i.e., Aindex1,index2,.,indexN), and dot indexing (i.e., A.fieldname).TipsIt is important to note the significance of numel with regards to the overloaded subsref and su

25、bsasgn functions. In the case of the overloaded subsref function for brace and dot indexing (as described in the last paragraph), numel is used to compute the number of expected outputs (nargout) returned from subsref. For the overloaded subsasgn function, numel is used to compute the number of expected inputs (nargin) to be assigned using subsasgn. The nargin value for the overloaded subsasgn function is the value returned by numel plus 2 (one for the variable being assigned to, and one for the structure array of subscripts).As a class designer, yo

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1