正在加载图片...
Thinking in a Matrix Wav Can you work out what 1and 2 will look like before displaying them?In the fol wing ta able we present other examples showing how to use variables already implemented to create new variables Matlab (type after the representation prompt>>followed by Enter) Dimension M=B12π =[3,12,p1]; 1x3 Row vector w- =[3,12,p1:8,9,10] 2×3 Matrix Orequivalently.if you have already inserted M w=:8,9,101: 4 P=4:2-11 3xI Column P=2 vector -1 Q=4.-4:2-2-1,1h 3x2 Matrix Orequivalently.if you have already inserted P: -11 Q-[P:-PJ: If you do not specify any variable content (ie.any values inside the square brackets).MATLAB cr a variable of size zero with no value,or more precisely a matrix of dimension 0x0 with no value in it. >y=【J <ENTER> >whos y <ENTER> Name Size Bytes class Attributes 0x0 0 double The Workspace Browser in the desktop provides a handy visual representation of the workspace.By clicking a variable in the Workspace Browser.we open the Array Editor.which can be used to view and cha values entry that lies in the ith row and the jth olumn of a matrix is typically referred to as the (ij).or (ij)th entry of the matrix.For example,the (3.2)entry of matrix Q in the table above is 1.In mathematical format,it is usually written as Q, while in MATLAB you can access to the matrix entries in this way: >>0(3,2) <ENTER> ans of parentheses.Forindexing you use parentheses.whereas todefine a matrix,you use square brackets;otherwise,you get an error: >0[2,3] ??Q[2,3] Error:Unbalanced or unexpected parenthesis or bracket. Thinking in a Matrix Way 11 Can you work out what z1 and z2 will look like before displaying them? In the following table we present other examples showing how to use variables already implemented to create new variables: Mathematical representation MATLAB (type after the prompt >> followed by Enter) Dimension M=[3,12,pi]; 1 × 3 Row vector 3 12 8 9 10 N ⎡ ⎤ p = ⎢ ⎥ ⎣ ⎦ N=[3,12,pi; 8,9,10]; 2 × 3 Matrix Or equivalently, if you have already inserted M: N=[M; 8,9,10]; 4 2 1 P ⎡ ⎤ ⎢ ⎥ = ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ − P=[4;2;−1] 3 × 1 Column vector 4 4 2 2 1 1 Q ⎡ ⎤ − ⎢ ⎥ = − ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ − Q=[4, −4;2, −2;−1, 1]; 3 × 2 Matrix Or equivalently, if you have already inserted P: Q=[P;−P]; If you do not specify any variable content (i.e., any values inside the square brackets), MATLAB creates a variable of size zero with no value, or more precisely, a matrix of dimension 0 × 0 with no value in it. >> y = [ ]; <ENTER> >> whos y <ENTER> Name Size Bytes Class Attributes y 0x0 0 double The Workspace Browser in the desktop provides a handy visual representation of the workspace. By clicking a variable in the Workspace Browser, we open the Array Editor, which can be used to view and change values. The entry that lies in the i th row and the j th column of a matrix is typically referred to as the ( i , j ), or ( i , j )th entry of the matrix. For example, the (3,2) entry of matrix Q in the table above is 1. In mathematical format, it is usually written as Q 3,2 , while in MATLAB you can access to the matrix entries in this way: >> Q(3,2) <ENTER> ans = 1 Note the use of parentheses. For indexing you use parentheses, whereas to defi ne a matrix, you use square brackets; otherwise, you get an error: >>Q[2,3] ??? Q[2,3] | Error: Unbalanced or unexpected parenthesis or bracket. M = [ ] 3 12 p
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有