正在加载图片...
8 I Basic Operations The command clear can be followed by the specification a11,and all the variables stored in the workspace are deleted.To test whether this is indeed the case,type the whos command: >clear all >whos Note that you receive no answer from MATLAB because there is nothing to display. At the same time,you can see that the Workspace Window(Fig.1.1)is empty. With variables you can type complex expressions and store the result.Let's try: >number=13; <ENTER> >a=14; <ENTER> >c=pi+((number+a/2)/10); <ENTER> MATLAB doesn't give an answer because you ended the command with the semicolon which prevents the value of number from being echoed on the screen However,number still has the value 13,as you can see by entering its name without a semicolon (or looking at the Workspace Window): <ENTER> number 3 >>c <ENTER> C= 6.2832 Thinking in a Matrix Way Our first destion abo matrices sWhat is a Matrix?We are not talking ab the fim.the sequels,the muaion that you have ”8am For us,a matrix isn't e to do battl with to save humamy However,you can choose to continue to read the book (in analogy to the blue pill in the film that allows you to lead your normal life)to learn how use MATrix LABoratory to create innovative experiments,thereby changing the world with your discoveries. In MATLAB.a matrix is a rectangular array of numbers.as shown in the follow- ing Fig.1.2. The zontal lines of a matrix are called s,and the vertical lines are called T numbers in the matrix are called en A matrix with m rov is called an mxn matrix.A matrix one of whose dimensions ws andr equals one is often called a vector.An mx I matrix (one column and m rows)is called a column vector,and a Ixn matrix (one row and n columns)is called a row vector.8 1 Basic Operations The command clear can be followed by the specifi cation all , and all the variables stored in the workspace are deleted. To test whether this is indeed the case, type the whos command: >> clear all <ENTER> >> whos <ENTER> >> Note that you receive no answer from MATLAB because there is nothing to display. At the same time, you can see that the Workspace Window (Fig. 1.1 ) is empty. With variables you can type complex expressions and store the result. Let’s try: >> number=13; <ENTER> >> a=14; <ENTER> >> c=pi*((number+a/2)/10); <ENTER> MATLAB doesn’t give an answer because you ended the command with the semicolon (;) which prevents the value of number from being echoed on the screen. However, number still has the value 13, as you can see by entering its name without a semicolon (or looking at the Workspace Window): >> number <ENTER> number = 13 >> c <ENTER> c = 6.2832 Thinking in a Matrix Way Our fi rst question about matrices is, “What is a Matrix?” We are not talking about the fi lm , the sequels, the comic books, or the video games. For us, a matrix isn’t a complex computer simulation that you have to do battle with to save humanity. However, you can choose to continue to read the book (in analogy to the blue pill in the fi lm that allows you to lead your normal life) to learn how use MATrix LABoratory to create innovative experiments, thereby changing the world with your discoveries. In MATLAB, a matrix is a rectangular array of numbers, as shown in the follow￾ing Fig. 1.2 . The horizontal lines of a matrix are called rows, and the vertical lines are called columns. The numbers in the matrix are called entries. A matrix with m rows and n columns is called an m × n matrix. A matrix one of whose dimensions equals one is often called a vector. An m × 1 matrix (one column and m rows) is called a column vector, and a 1 × n matrix (one row and n columns) is called a row vector
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有