Elementary mathematical and computational tools for electrical and computer engineers using Matlab - Chapter 7 pot

34 270 0
Elementary mathematical and computational tools for electrical and computer engineers using Matlab - Chapter 7 pot

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

0-8493-????-?/00/$0.00+$.50 © 2000 by CRC Press LLC © 2001 by CRC Press LLC 7 Vectors 7.1 Vectors in Two Dimensions (2-D) A vector in 2-D is defined by its length and the angle it makes with a reference axis (usually the x-axis). This vector is represented graphically by an arrow. The tail of the arrow is called the initial point of the vector and the tip of the arrow is the terminal point. Two vectors are equal when both their length and angle with a reference axis are equal. 7.1.1 Addition The sum of two vectors is a vector constructed graphically as fol- lows. At the tip of the first vector, draw a vector equal to the second vector, such that its tail coincides with the tip of the first vector. The resultant vector has as its tail that of the first vector, and as its tip, the tip of the just-drawn second vector (the Parallelogram Rule) (see Figure 7.1). The negative of a vector is that vector whose tip and tail have been exchanged from those of the vector. This leads to the conclusion that the dif- ference of two vectors is the other diagonal in the parallelogram (Figure 7.2). 7.1.2 Multiplication of a Vector by a Real Number If we multiply a vector by a real number k, the result is a vector whose length is k times the length of , and whose direction is that of if k is pos- itive, and opposite if k is negative. 7.1.3 Cartesian Representation It is most convenient for a vector to be described by its projections on the x-axis and on the y-axis, respectively; these are denoted by (v 1 , v 2 ) or (v x , v y ). In this representation: r rr uv w+= r v r v r v © 2001 by CRC Press LLC (7.1) where ê 1 and ê 2 are the unit vectors (length is 1) parallel to the x-axis and y-axis, respectively. In terms of this representation, we can write the zero vec- tor, the sum of two vectors, and the multiplication of a vector by a real num- ber as follows: FIGURE 7.1 Sum of two vectors. FIGURE 7.2 Difference of two vectors. r uuu uê uê==+(, )() () 12 11 22 © 2001 by CRC Press LLC (7.2) (7.3) (7.4) Preparatory Exercise Pb. 7.1 Using the above definitions and properties, prove the following identities: The norm of a vector is the length of this vector. Using the Pythagorean the- orem, its square is: (7.5) and therefore the unit vector in the direction, denoted by ê u , is given by: (7.6) All of the above can be generalized to 3-D, or for that matter to n-dimensions. For example: (7.7) r 0000 0 12 ==+(,) êê r rr uv w u vu v u vê u vê+= = + + = + + +(, )()() 1122 111 222 ku ku ku ku ê ku ê r ==+(, )() () 12 11 22 r rr r r rr r rr r rr rr rr r rr r r r r rrr uv vu uv wu vw uuu uu klu klu ku v ku kv klukulu +=+ ++=++ +=+= +− = = += + +=+ () ( ) () () () () () 00 0 r uuu 2 1 2 2 2 =+ r u ê uu uu u = + 1 1 2 2 2 12 (, ) ê uu u uu u u n n = ++… … 1 1 2 2 22 12 (, , , ) © 2001 by CRC Press LLC 7.1.4 MATLAB Representation of the Above Results MATLAB distinguishes between two kinds of vectors: the column vector and the row vector. As long as the components of the vectors are all real, the dif- ference between the two is in the structure of the array. In the column vector case, the array representation is vertical and in the row vector case, the array representation is horizontal. This distinction is made for the purpose of including in a consistent structure the formulation of the dot product and the definition of matrix multiplication. Example 7.1 Type and execute the following commands, while interpreting the output at each step: V=[1 3 5 7] W=[1;3;5;7] V' U=3*V Z=U+V Y=V+W %you cannot add a row vector and a column %vector You would have observed that: 1. The difference in the representation of the column and row vectors is in the manner they are separated inside the square brackets. 2. The single quotation mark following a vector with real components changes that vector from being a column vector to a row vector, and vice versa. 3. Multiplying a vector by a scalar simply multiplies each component of this vector by this scalar. 4. You can add two vectors of the same kind and the components would be adding by pairs. 5. You cannot add two vectors of different kinds; the computer will give you an error message alerting you that you are adding two quantities of different dimensions. The MATLAB command for obtaining the norm of a vector is norm. Using this notation, it is a simple matter to define the unit vector in the same direc- tion as a given vector. Example 7.2 Find the length of the vector and the unit vector u = [1 5 3 2] and the unit vector parallel to it. © 2001 by CRC Press LLC u=[1 5 3 2] lengthu=norm(u) %length of vector u unitu=u/(norm(u)) %unit vector parallel to u lengthunitu=norm(unitu) %verify length of unit vector 7.2 Dot (or Scalar) Product If the angle between the vectors and is θ, then the dot product of the two vectors is: (7.8) The dot product can also be expressed as a function of the vectors compo- nents. Referring to Figure 7.3, we know from trigonometry the relation relat- ing the length of one side of a triangle with the length of the other two sides and the cosine of the angle between the other two sides. This relation is the generalized Pythagorean theorem. Referring to Figure 7.3, this gives: (7.9) but since: FIGURE 7.3 The geometry of the generalized Pythagorean theorem. r u r v r r r r uv uv⋅= cos( )θ PQ u v u v 2 2 2 2=+− r r r r cos( )θ © 2001 by CRC Press LLC (7.10) (7.11) and the dot product can be written as: (7.12) In an n-dimensional space, the above expression is generalized to: (7.13) and the norm square of the vector can be written as the dot product of the vector with itself; that is, (7.14) Example 7.3 Parallelism and orthogonality of two vectors in a plane. Let the vectors and be given by: What is the value of a if the vectors are parallel, and if the vectors are orthogonal? Solution: Case 1: If the vectors are parallel, this means that they make the same angle with the x-axis. The tangent of this angle is equal to the ratio of the vector x-component to its y-component. This means that: Case 2: If the vectors are orthogonal, this means that the angle between them is 90°, and their dot product will be zero because the cosine for that angle is zero. This implies that: Example 7.4 Find the unit vector in 2-D that is perpendicular to the line ax + by + c = 0. PQ v u r r r =− ⇒=+−− r r r rr r uv u v v ucos( ) ( )θ 1 2 2 2 2 r r uv u u v v v u v u uv uv⋅= +++− − − − = + 1 2 1 2 2 2 1 2 2 2 11 2 22 2 11 22 (()() r r uv uv uv uv nn ⋅= + +…+ 11 22 rrr uuuuu u n 2 1 2 2 22 =⋅= + +…+ r u r v r r u ê ê v aê ê=+ =+34 7 12 12 and . a a 7 3 4 21 4=⇒=/ 3 28 0 28 3aa+=⇒=−/ © 2001 by CRC Press LLC Solution: Choose two arbitrary points on this line. Denote their coordinates by (x 1 , y 1 ) and (x 2 , y 2 ); being on the line, they satisfy the equation of the line: Substracting the first equation from the second equation, we obtain: which means that and the unit vector perpendicular to the line is: Example 7.5 Find the angle that the lines 3x + 2y + 2 = 0 and 2x – y + 1 = 0 and make together. Solution: The angle between two lines is equal to the angle between their nor- mal unit vectors. The unit vectors normal to each of the lines are, respectively: Having the two orthogonal unit vectors, it is a simple matter to compute the angle between them: 7.2.1 MATLAB Representation of the Dot Product The dot product is written as the product of a row vector by a column vector of the same length. Example 7.6 Find the dot product of the vectors: ax by c ax by c 11 22 0 0 ++= ++= ax x by y()() 21 21 0−+ −= (,) ( , ),ab x x y y⊥− − 2121 ê a ab b ab ⊥ = ++       22 22 , ˆ , ˆ ,nn 12 3 13 2 13 2 5 1 5 =       = −       and cos( ) ˆˆ .θθ=⋅= ⇒=nn 12 4 65 1 0517 radians © 2001 by CRC Press LLC u = [1537]andv = [2468] Solution: Type and execute each of the following commands, while interpret- ing each output: u=[1 5 3 7] v=[2 4 6 8] u*v' v'*u u*v %you cannot multiply two rows u'*v u*u' (norm(u))^2 As observed from the above results, in MATLAB, the dot product can be obtained only by the multiplication of a row on the left and a column of the same length on the right. If the order of a row and column are exchanged, we obtain a two-dimensional array structure (i.e., a matrix, the subject of Chap- ter 8). On the other hand, if we multiply two rows, MATLAB gives an error message about the non-matching of dimensions. Observe further, as pointed out previously, the relation between the length of a vector and its dot product with itself. In-Class Exercises Pb. 7.2 Generalize the analytical technique, as previously used in Example 7.4 for finding the normal to a line in 2-D, to find the unit vector in 3-D that is perpendicular to the plane: ax + by + cz + d = 0 (Hint: A vector is perpendicular to a plane if it is perpendicular to two non- collinear vectors in that plane.) Pb. 7.3 Find, in 2-D, the distance of the point P(x 0 , y 0 ) from the line ax + by + c = 0. (Hint: Remember the geometric definition of the dot product.) Pb. 7.4 Prove the following identities: r rr rr rr r r r r r r r r uv vu u v w uv uw k uv ku v⋅=⋅ ⋅ + =⋅+⋅ ⋅ ⋅ = ⋅,( ) ,()() © 2001 by CRC Press LLC 7.3 Components, Direction Cosines, and Projections 7.3.1 Components The components of a vector are the values of each element in the defining n-tuplet representation. For example, consider the vector = [1537] in real 4-D. We say that its first, second, third, and fourth components are 1, 5, 3, and 7, respectively. (We are maintaining, in this section, the arrow nota- tion for the vectors, irrespective of the dimension of the space.) The simplest basis of a n-dimensional vector space is the collection of n unit vectors, each having only one of their components that is non-zero and such that the location of this non-zero element is different for each of these basis vectors. This basis is not unique. For example, in 4-D space, the canonical four-unit orthonormal basis vec- tors are given, respectively, by: ê 1 = [1000] (7.15) ê 2 = [0100] (7.16) ê 3 = [0010] (7.17) ê 4 = [0001] (7.18) and the vector can be written as a linear combination of the basis vectors: (7.19) The basis vectors are chosen to be orthonormal, which means that in addi- tion to requiring each one of them to have unit length, they are also orthogonal two by two to each other. These properties of the basis vectors leads us to the following important result: the m th component of a vector is obtained by tak- ing the dot product of the vector with the corresponding unit vector, that is, (7.20) 7.3.2 Direction Cosines The direction cosines are defined by: r u r u r uuêuêuêuê=+++ 11 22 33 44 uêu mm =⋅ r © 2001 by CRC Press LLC (7.21) In 2-D or 3-D, these quantities have the geometrical interpretation of being the cosine of the angles that the vector makes with the x, y, and z axes. 7.3.3 Projections The projection of a vector over a vector is a vector whose magnitude is the dot product of the vector with the unit vector in the direction of , denoted by ê a , and whose orientation is in the direction of ê a : (7.22) The component of that is perpendicular to is obtained by subtracting from the projection vector of over . MATLAB Example Assume that we have the vector = ê 1 + 5ê 2 + 3ê 3 + 7ê 4 and the vector = 2ê 1 + 3ê 2 + ê 3 + 4ê 4 . We desire to obtain the components of each vector, the projec- tion of over , and the component of orthogonal to . Type, execute, and interpret at each step, each of the following commands using the above definitions: u=[1 5 3 7] a=[2 3 1 4] u(1) a(2) prjuovera=((u*a')/(norm(a)^2))*a orthoutoa=u-prjuovera prjuovera*orthoutoa' The last command should give you an answer that is zero, up to machine round-up errors because the projection of over and the component of orthogonal to are perpendicular. 7.4 The Dirac Notation and Some General Theorems* Thus far, we have established some key practical results in real finite dimen- sional vector spaces; namely: cos( )γ m mm u u êu u == ⋅ r r r r u r u r a r u r a proj u u ê ê ua a a a ua a a a aa r rr r r r r r r r r r () ( )=⋅ = ⋅ = ⋅ 2 r u r a r u r u r a r u r a r u r a r u r a r u r a r u r a [...]... 1)Pl ( x) dx dx (7. 94) and x dPl ( x) dPl−1 ( x) − = lPl ( x) dx dx (7. 95) Adding Eqs (7. 94) and (7. 95), we obtain the more symmetric formula: dPl+1 ( x) dPl−1 ( x) − = (2l + 1)Pl ( x) dx dx (7. 96) Replacing l by l – 1 in Eq (7. 94) and eliminating Pl′ 1 ( x) from Eq − (7. 95), we find that: (1 − x 2 ) dPl ( x) = lPl−1 ( x) − lxPl ( x) dx (7. 97) Differentiating Eq (7. 97) and using Eq (7. 95), we obtain:... for − 1 ≤ x ≤ a for a < x ≤ 1 (7. 112) Solution: The conditions for the above theorem are satisfied, and  cl = l +  1 2 1 ∫ P (x)dx a l (7. 113) From Eq (7. 96), and noting that Pl(1) = 1, we find that: c0 = 1 (1 − a) 2 (7. 114) and 1 cl = − [Pl+1 ( a) − Pl−1 ( a)] 2 (7. 115) We show in Figure 7. 4 the sum of the truncated decomposition for Example 7. 10 for different values of lmax FIGURE 7. 4 The plot of... of Eq (7. 43), which relates the equivalent resistances of n-resistors in series and in parallel, under what conditions does the equality hold? 7. 5 Cross Product and Scalar Triple Product* In this section and in Sections 7. 6 and 7. 7, we restrict our discussions to vectors in a 3-D space, and use the more familiar conventional vector notation 7. 5.1 Cross Product r r r r then their cross product, denoted... multiplying Eq (7. 28) on the left by m Using Eq (7. 26), we deduce: © 2001 by CRC Press LLC mu = ∑c mn = n n ∑c δ n m, n = cm (7. 29) n Next, using the Dirac notation, we present the proofs of two key theorems of vector algebra: the Cauchy-Schwartz inequality and the triangle inequality 7. 4.1 Cauchy-Schwartz Inequality Let u and v be any non-zero vectors; then: uv PROOF 2 ≤ uu v v (7. 30) Let ε = ±1,... following important result for the equivalent resistance for resistors all in series or all in parallel Application The equivalent resistance of n-resistors all in series and the equivalent resistance of the same n-resistors all in parallel obey the relation: n2 ≤ © 2001 by CRC Press LLC Rseries Rparallel (7. 43) The proof is straightforward Using Eq (7. 37) and recalling Ohm’s law for n resistors {R1, R2,...  PROOF (7. 37) Choose the vectors v and w such that: 1 1 1/2 v = u1 , u2/2 , u3/2  1 w =    u1  1/2  1 ,    u2  1/2  1 ,    u3  (7. 38) 1/2 (7. 39) then: v w =3 (7. 40) v v = (u1 + u2 + u3 ) (7. 41)  1 1 1 w w = + +   u1 u2 u3  (7. 42) Applying the Cauchy-Schwartz inequality in Eq (7. 36) establishes the desired result The above inequality can be trivially generalized to n-elements,... − j 2 πmt) exp( j 2 πnt)dt =  −1/2 0 if m ≠ n  ∫ 1/2 (7. 72) Decomposition rule: ∞ ϕ = ∑ ∞ cn un = n=−∞ ∑c exp( j 2 πnt) (7. 73) exp( − j 2 πnt)ϕ(t)dt (7. 74) n n=−∞ where cn = un ϕ = ∫ 1/2 −1/2 Parseval’s identity: ϕ 2 = ϕϕ = ∫ 1/2 −1/2 ϕ(t)ϕ(t)dt = ∫ 1/2 −1/2 ∞ 2 ϕ(t) dt = ∑c 2 n (7. 75) n=−∞ Example 7. 9 Derive the analytic expression for the potential difference across the capacitor in the RLC circuit... 4ac ≤ 0 (7. 34) Replacing a, b, c by their values from Eq (7. 32), we obtain: 4 uv 2 −4 u u v v ≤0 ⇒ uv © 2001 by CRC Press LLC 2 ≤ uu v v (7. 35) (7. 36) which is the desired result Note that the equality holds if and only if the two vectors are linearly dependent (i.e., one vector is equal to a scalar multiplied by the other vector) Example 7. 7 Show that for any three non-zero numbers, u1, u2, and u3,... base MATLAB Representation r r The cross product of the vectors u = (u1 , u2 , u3 ) and v = (v1 , v2 , v3 ) is found using the cross(u,v) command r r r The triple scalar product of the vectors u, v , and w is found through the det([u;v;w]) command Make sure that the vectors defined as arguments of these functions are defined as 3-D vectors, so that the commands work and the results make sense Example 7. 8... Pl2 ( x)dx = (2l − 1) (2l + 1) ∫ 1 −1 2 Pl−1 ( x)dx (7. 1 07) Repeated applications of this formula and the use of Eq (7. 86) yields: ∫ 1 −1 Pl2 ( x)dx = 3 (2l + 1) ∫ 1 −1 P12 ( x)dx = 2 (2l + 1) (7. 108) Direct calculations show that this is also valid for l = 0 and l = 1 Therefore, the orthonormal basis functions are given by: ul = l + 1 P ( x) 2 l (7. 109) The general theorem that summarizes the decomposition . the following ine- quality always holds: (7. 37) PROOF Choose the vectors such that: (7. 38) (7. 39) then: (7. 40) (7. 41) (7. 42) Applying the Cauchy-Schwartz inequality in Eq. (7. 36) establishes. unique. For example, in 4-D space, the canonical four-unit orthonormal basis vec- tors are given, respectively, by: ê 1 = [1000] (7. 15) ê 2 = [0100] (7. 16) ê 3 = [0010] (7. 17) ê 4 = [0001] (7. 18) and. Product and Scalar Triple Product* In this section and in Sections 7. 6 and 7. 7, we restrict our discussions to vectors in a 3-D space, and use the more familiar conventional vector notation. 7. 5.1

Ngày đăng: 13/08/2014, 02:21

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan