传递矩阵法
- 格式:ppt
- 大小:1.06 MB
- 文档页数:30
传递矩阵法matlab程序传递矩阵法是一种在数值计算中常用的方法,特别适用于处理大规模的线性方程组。
在Matlab中,我们可以利用矩阵运算的特性,通过编写一段简洁的程序来实现矩阵的传递。
矩阵传递的基本思想是将多个矩阵的运算结果传递给下一个矩阵,从而实现复杂的运算。
在Matlab中,我们可以利用矩阵乘法的特性,将矩阵的运算结果保存在一个中间变量中,并将该中间变量传递给下一个矩阵进行运算。
我们需要定义需要进行运算的矩阵。
在Matlab中,可以通过直接赋值或者从文件中读取的方式来定义矩阵。
例如,我们可以使用以下代码定义一个3x3的矩阵A:A = [1, 2, 3; 4, 5, 6; 7, 8, 9];接下来,我们可以定义一个中间变量B,并将矩阵A传递给B:B = A;这样,矩阵A的运算结果就被传递给了矩阵B。
我们可以通过对矩阵B进行进一步的运算,实现复杂的计算。
例如,我们可以定义一个矩阵C,并将矩阵B传递给C进行运算:C = B * B';在这个例子中,矩阵B的转置与矩阵B相乘的结果被传递给了矩阵C。
通过这样的传递,我们可以实现复杂的矩阵运算。
除了简单的矩阵乘法外,矩阵传递法还可以应用于其他形式的矩阵运算,例如矩阵的加法、减法、乘法等。
通过灵活地利用矩阵传递法,我们可以简化程序的编写过程,提高效率。
在编写矩阵传递法的程序时,我们应注意以下几点:1. 矩阵的维度要匹配。
在进行矩阵传递前,需要确保传递的矩阵维度是相同的,否则会导致运算错误。
2. 矩阵的类型要一致。
在进行矩阵传递时,需要确保传递的矩阵类型是一致的,例如都是实数矩阵或都是复数矩阵,否则会导致运算结果不正确。
3. 矩阵的运算顺序要正确。
在进行矩阵传递时,需要确保传递的顺序是正确的,例如先进行矩阵A的运算,再将结果传递给矩阵B进行运算,否则会导致运算结果不正确。
通过以上几点的注意,我们可以编写出一个高效、准确的矩阵传递法程序。
在实际应用中,矩阵传递法可以广泛应用于科学计算、工程建模等领域,帮助我们快速、准确地求解复杂的数值问题。
传递矩阵法matlab程序传递矩阵法是一种在MATLAB中进行矩阵运算和矩阵传递的有效方法。
在本文中,我将介绍传递矩阵法的原理和在MATLAB中的具体实现。
传递矩阵法是一种通过矩阵传递信息的方法,它可以用于解决一些复杂的问题,例如网络流、图论等。
在传递矩阵法中,我们将问题转化为矩阵运算的形式,通过对矩阵进行操作和传递,达到求解问题的目的。
在MATLAB中,我们可以使用矩阵运算和矩阵操作函数来实现传递矩阵法。
首先,我们需要定义问题的初始矩阵。
这个矩阵可以是问题的描述、条件或者初始状态。
然后,我们根据问题的要求,通过矩阵运算和矩阵操作函数来对初始矩阵进行操作和传递。
最后,我们可以得到问题的解或者结果。
在传递矩阵法中,矩阵的元素通常代表问题中的某种状态或者信息。
通过对矩阵进行运算和操作,我们可以传递信息并改变矩阵的状态。
例如,在网络流问题中,矩阵的元素可以表示节点之间的连接关系或者流量。
通过对矩阵进行运算,我们可以传递流量,计算最大流量或者最小割。
在MATLAB中,我们可以使用矩阵乘法、矩阵加法、矩阵转置等运算来操作矩阵。
此外,MATLAB还提供了一些专门用于矩阵操作的函数,例如矩阵求逆、矩阵特征值分解等。
通过这些运算和函数,我们可以对矩阵进行传递和操作,实现传递矩阵法。
下面,我将通过一个简单的例子来演示传递矩阵法在MATLAB中的应用。
假设我们有一个由节点和边组成的图,我们希望计算出图中任意两个节点之间的最短路径。
我们可以使用一个邻接矩阵来表示图中节点之间的连接关系。
邻接矩阵的元素可以是0或者1,分别表示两个节点之间是否有边连接。
接下来,我们可以通过矩阵乘法来计算出任意两个节点之间的距离。
在MATLAB中,我们可以使用函数graph和函数shortestpath来实现这个过程。
首先,我们可以使用函数graph来创建一个图对象,将邻接矩阵作为输入。
然后,我们可以使用函数shortestpath来计算任意两个节点之间的最短路径。
Transfer Matrix MethodG.Eric Moorhouse,University of WyomingReference:Transfer Matrix MethodI.M.Gessel and R.P.Stanley,‘Algebraic Enu-meration’,in Handbook of Combinatorics Vol.2, ed.R.L.Graham et al.,Elsevier,1995,pp.1021–1061.References:Dimensions of CodesN.Hamada,‘The rank of the incidence matrixof points and d-flats infinite geometries’,J. Sci.Hiroshima Univ.Ser.A-I32(1968),381–396.M.Bardoe and P.Sin,‘The permutation mod-ules for GL(n+1,q)acting on P n(q)and F n+1q’,to appear in JLMS./~sin/preprints/hamada.dviG.E.Moorhouse,‘Dimensions of Codes from Finite Projective Spaces’(as html and as Maple worksheet)/~moorhous/src/hamada.html /~moorhous/src/hamada.mwsProblem1Let S k be the set of‘words’of length k consist-ing of‘a’s and‘b’s,with no two consecutive ‘b’s.Determine F k=|S k|.F0=1‘’F1=2‘a’‘b’F2=3‘aa’‘ab’‘ba’F3=5‘aaa’‘aab’‘aba’‘baa’‘bab’F4=8‘aaaa’‘aaab’‘aaba’‘abaa’‘abab’‘baaa’‘baab’‘baba’etc.This gives all but thefirst term of the Fibonacci sequence1,1,2,3,5,8,13,21,34,55,89,144,...To find a formula for F k ,we work instead with the generating function∞k =0F k t k =1+2t +3t 2+5t 3+8t 4+13t 5+···Observe that words w ∈S k correspond to paths of length k ,starting at vertex 1in the digraph12..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................append ‘a’append ‘a’append ‘b’Words not ending in ‘b’Words ending in ‘b’Agenda1.Motivating Problem1(above)2.Counting Walks by the Transfer Matrix Method3.Application to Problem14.Counting Closed Walks5.Counting Weighted Walks in Digraphs withWeighted Edges6.MAPLE Worksheet for Problem17.Application to Coding TheoryThe Transfer Matrix Method Let D be a digraph (directed graph),possibly with loops,having vertices 1,2,3,...,n .Let A =[a ij :1≤i,j ≤n ]be the adjacency matrix of D ;in other words,a ij = 1,if (i,j )is an edge of D ;0,otherwise.A walk of length k in D is a sequence......................................................................................................................................................................................................................................................................................................................................···◦◦◦◦i 0i 1i 2i k→→→→of (not necessarily distinct)vertices such that each ...........................................................................................◦◦i r −1i r →is an edge of D .Counting Walks from i to jLet w ij(k)be the number of walks of length k from vertex i to vertex j in D.Then w ij(k)is the(i,j)-entry of A k.This is readily computed by reading offthe coefficient of t k in the gen-erating function k≥0w ij(k)t k which in turn is the(i,j)-entry of(I−tA)−1=I+tA+t2A2+t3A3+···. Since the(i,j)-entry of(I−tA)−1is of the formpoly.in t of degree≤n−1det(I−tA),w ij(k)satisfies a linear recurrencew ij(k+n)=n−1r=0c r w ij(k+r)for all k≥0where det(I−tA)=1−c n−1t−c n−2t2−···−c0t n.The initial conditions w ij(0),w ij(1),..., w ij(n−1)depend on i and j but the recurrence does not.Counting All WalksLet w(k)= n i=1 n j=1w ij(k),the total num-ber of walks of length k.This is the coefficient of t k in the sum of the entries of(I−tA)−1.In particular w(k)satisfies the same recurrence as the w ij(k)’s:w(k+n)=n−1r=0c r w(k+r)for all k≥0but with different initial conditions.Counting Closed WalksLet w closed(k)= n i=1w ii(k),the total number of closed walks of length k(i.e.starting and ending at the same vertex).This is the coef-ficient of t k in trace((I−tA)−1).In particular w closed(k)satisfies the same linear recurrence as the w ij(k)’s and w(k),but again with different initial conditions.Here we assumed the initial/final vertex to be distinguished,i.e.the walks(i0,i1,i2,...,i k)and (i1,i2,...,i k,i0)are counted as distinct unless all i0=i1=···=i k.ExampleLet F k be the number of‘words’of length k consisting of‘a’s and‘b’s,with no two con-secutive‘b’s.F0=1‘’F1=2‘a’‘b’F2=3‘aa’‘ab’‘ba’F3=5‘aaa’‘aab’‘aba’‘baa’‘bab’F4=8‘aaaa’‘aaab’‘aaba’‘abaa’‘abab’‘baaa’‘baab’‘baba’etc.This gives all but thefirst term of the Fibonacci sequence1,1,2,3,5,8,13,21,34,55,89,144,...Observe that F k is the number of paths of length k ,starting at vertex 1in the digraph12.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................append ‘a’append ‘a’append ‘b’Words not ending in ‘b’Words ending in ‘b’A = 111(I −tA )−1=11−t −t 2 1t t 1−tk ≥0F k t k =sum of (1,1)-and (1,2)-entries of (I −tA )−1=1+t 1−t −t 2=1√5 α21−αt −β21−βt=1√5 k ≥0(αk +2−βk +2)t k where α=(1+√5)/2,β=(1−√5)/2.From (1−t −t 2) k ≥0F k t k =1+t we obtainF k = 1,if k =0;2,if k =1;F k −1+F k −2,if k ≥2so by induction,F k is the (k +1)st Fibonacci number.From the series expansion we obtain the explicit formulaF k =αk +2−βk +2√5for k ≥0.Wraparound VersionLet L k(for k≥0)be the number of‘words’of length k consisting of‘a’s and‘b’s with no consecutive‘b’s,and which do not both start and end with‘b’.For technical reasons we will take L0=2.For k≥2,we are simply counting necklaces with a mber and b lack beads having no two consecutive black beads;however,each neck-lace has a distinguished starting point(a knot in its cord)and a distinguished direction(clock-wise or counter-clockwise).L1=1‘a’L2=3‘aa’‘ab’‘ba’L3=4‘aaa’‘aab’‘aba’‘baa’L4=7‘aaaa’‘aaab’‘aaba’‘abaa’‘abab’‘baaa’‘baba’These are the familiar Lucas numbers which satisfy the same recurrence relation as the Fi-bonacci numbers,but a different initial condi-tion.Note that L k is the number of closed walks of length k in our digraph.k ≥0L k t k =trace ((I −tA )−1)=2−t 1−t −t 2=11−αt +11−βt=k ≥0(αk +βk )t kFrom (1−t −t 2) k ≥0L k t k =2−t we obtainL k = 2,if k =0;1,if k =1;L k −1+L k −2,if k ≥2From the series expansion we obtain the ex-plicit formulaL k=αk+βk for k≥0.Counting Walks with Weighted Edges As before,D is a digraph (directed graph),pos-sibly with loops,having vertices 1,2,3,...,n .Assign a weight to each edge:...........................................................................................◦◦i j →a ij (Non-edges have weight zero.)Define the weight of a walk......................................................................................................................................................................................................................................................................................................................................···◦◦◦◦i 0i 1i 2i k →→→→a i 0i 1a i 1i 2a i 2i 3a i k −1i k of length k to be the producta i 0i 1a i 1i 2a i 2i 3···a i k −1i k .Let A =[a ij :1≤i,j ≤n ].Thenw ij(k):=The sum of all weightsof walks in D of length k from vertex i to vertex j=(i,j)-entry of A khas generating function k≥0w ij(k)t k equal to the(i,j)-entry of(I−tA)−1=I+tA+t2A2+t3A3+···as before.ExampleWe have determined the number F k of words of length k consisting of‘a’s and‘b’s,with no two consecutive‘b’s.How many such words contain r‘a’s and(therefore)k−r‘b’s?12.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................a ab A = a b a0 (I −tA )−1=11−at −abt 2 1bt at 1−atThe sum of the (1,1)-and (1,2)-entries is1+bt1−at −abt 2=1+(a +b )t +(a 2+2ab )t 2+(a 3+3a 2b +ab 2)t 3+(a 4+4a 3b +3a 2b 2)t 4+···Thus,for example,among the F 4=8words of length 4,1has 4‘a’s and 0‘b’s;4have 3‘a’s and 1‘b’;3have 2‘a’s and 2‘b’s.Codes from Finite GeometryConsider the projective plane of order 2:•••••••a bc d e f g ..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................The binary code of this geometry is the sub-space C ≤F 7(where F ={0,1}mod 2)spanned by the lines:a b c d e f g a b c d e f g C ={0000000,1111111,1101000,0010111,0110100,1001011,0011010,1100101,0001101,1110010,1000110,0111001,0100011,1011100,1010001,0101110}|C|=24;dim C =4The code above is the 1-error correcting binary Hamming code of length 7.The projective plane is constructed from F 3by taking as points and lines the 1-and 2-dimensional subspaces of F 3.•••••••001010100011110111101.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................Codes of Finite Projective SpacesLet F be thefield of order p e,p prime.Pro-jective n-space over F has as its points,lines, etc.the subspaces of F n+1of dimension1,2, etc.Problem:Compute the dimension of the code C=C n,p,e,k spanned by the subspaces of codi-mension k.Solution by Hamada’s Formula(the follow-ing theorem)is usually computationally infea-sible.Solution by the Transfer Matrix MethodTheorem(Bardoe and Sin,1999)Define M(t)=(1+t+t2+···+t p−1)n+1.Let D=D n,p,e,k be the digraph with vertices 1,2,...,k,and the edge from vertex i to vertex j has weight equal to the coefficient of t pj−i in M(t).Thendim C n,p,e,k=1+sum of weights of closed walks of length ein D=1+ coeff.of t ein tr[(I−tA)−1]where A is the k×k matrix whose(i,j)-entry is the weight of edge(i,j)(defined above).Example:Projective Plane of Order2C=binary code spanned by the seven lines (subspaces of codimension k=1)M(t)=(1+t)3=1+3t+3t2+t3A=[3](coefficient of t1in M(t))(I−tA)−1= 1 1−3ttr[(I−tA)−1]=11−3t=1+3t+9t2+27t3+···dim C=1+3=4。
传递矩阵法是研究转子系统动力学问题的有效手段。
传递矩阵法还具有其它方法(如摄动有限元素法)无法比拟的优点,例如,在做转子系统的临界转速、阻尼固有频率和稳定性计算分析时,由于流体密封交叉刚度、油膜轴承、阻尼项往往是不对称的,再加上陀螺力矩的影响;这样,用随机有限元素法形成的单元刚度矩阵和系统总体刚度矩矩阵往往也是不对称的,阻尼也不可以简单地以小阻尼或比例阻尼系统来替代,求解这样一个非对称系统的复特征值问题,目前还没有一个较为理想的方法。
而传递矩阵法没有随机有限元法在求解这些的问题时带来的这些困难。
因此,传递矩阵法在转子系统动力学问题的研究中占有主导的地位。
传递矩阵法matlab程序传递矩阵法是一种用于计算机程序中传递和操作矩阵的方法,在Matlab中,它被广泛应用于矩阵运算和数据处理等领域。
本文将介绍传递矩阵法的原理和在Matlab中的具体实现。
传递矩阵法是一种通过矩阵传递来操作数据的方法。
它的基本原理是将需要进行操作的数据存储在矩阵中,然后通过矩阵的传递,实现对数据的处理和计算。
这种方法的优势在于可以利用矩阵的高效运算能力,简化程序的编写和调试过程。
在Matlab中,可以使用矩阵操作函数来实现传递矩阵法。
例如,可以使用矩阵的乘法运算来实现矩阵的传递。
假设我们有两个矩阵A 和B,我们希望将矩阵A的数据传递给矩阵B,可以使用如下的Matlab代码实现:```B = A;```这样,矩阵B就完全复制了矩阵A的数据。
通过这种方式,我们可以在程序中传递矩阵,进行各种操作和计算。
除了简单的传递,传递矩阵法还可以实现更复杂的操作。
例如,可以通过传递矩阵进行矩阵的相加、相减、相乘等运算。
假设我们有两个矩阵A和B,我们希望将它们相加得到矩阵C,可以使用如下的Matlab代码实现:```C = A + B;```这样,矩阵C的每个元素都等于矩阵A和矩阵B对应元素的和。
通过传递矩阵法,我们可以很方便地实现这样的矩阵运算。
除了矩阵的运算,传递矩阵法还可以用于数据处理和分析。
例如,可以通过传递矩阵来实现数据的转置、截取、排序等操作。
假设我们有一个矩阵A,我们希望将它的每一列按照从大到小的顺序进行排序,可以使用如下的Matlab代码实现:```B = sort(A,'descend');```这样,矩阵B的每一列都按照从大到小的顺序进行了排序。
通过传递矩阵法,我们可以在Matlab中进行各种复杂的数据处理和分析。
传递矩阵法在Matlab中的应用非常广泛。
无论是矩阵运算、数据处理还是图像处理,都可以通过传递矩阵法来实现。
它不仅提高了程序的效率和可读性,还简化了程序的编写和调试过程。
传递矩阵法求解变厚度旋转圆盘1.引言旋转圆盘是化工机械中的重要零件之一,由于这些机械以每分钟几千转至几万转做高速旋转,因此这些圆盘的强度问题备受人们关注.旋转圆盘中的应力与位移分析对圆盘的强度设计及结构优化有重要的实际意义.关于旋转圆盘的应力分析与位移计算问题,国内外众多学者进行了研究1-4].在文献5]讨论等厚度圆盘旋转与变厚度圆盘旋转的解析解,但对于厚度的变化不符合某一数学规律的圆盘,便无法得到其解析解.本文利用已有的简单盘的应力计算系数和边界条件,建立待定常数的传递矩阵,求得应力与位移,适用于任意轮廓的变厚度圆盘,方法简便实用.2.求解算法将旋转圆盘离散成若干个等厚度圆盘,如图1所示,这些圆盘的厚度均不相等.对于每个等厚度圆盘,其应力分量与位移由下式给出:图1 圆盘的离散化σri=-3+μ[]8ρω2r2+a i[]2+b i[]r 2.(1)σθi=-1+3μ[]8ρω2r2+a i[]2-b i[]r2.(2)u i=-1-μ2[]8eρω2r3+a ir[]2e(1-μ)+bi[]er(1+μ).(3)将最外面的等厚度圆盘视为第一个,应力、位移分量表示为σr1σθ1,u1以此类推,采用由外面的圆盘向中心逐个计算的方法.对于第i+1个圆盘,其内径是第i个圆盘的外径,根据同一界面处总径向应力和位移相等可得h i+1σr i+1=h iσr i,ui+1=u i,i=1,2…n-1.(4)整理可得1-μ[]2a i+1-(1+μ)n[]na-ia2b i+1=1-μ[]2a i-(1+μ)n[]na-ia2b i,h i+1[]2a i+1+h i+1n[]na-ia2bi+1=h i[]2a i+h in[]na-ia2b i+3+μ[]8ρω2n[]na-ia2(h i+1-h i).每个圆盘的厚度取一个平均厚度,即h i=t i+t i+1 []2,i=1,2…n-1,靠近中心处的圆盘的厚度取为h n=t n.其中,t i=c(n+1-i)a[]n n,i=1,2,…,n.联立以上方程组求解后写成传递矩阵形式,即a i+1b i+1=1-μ[]2+h i(1+μ)[]2h i+1 n[]na-ia2(h i-hi+1(1+μ)[]h i+1n[]na-ia2(1-μ)(h i-h i+1)[]4h i+1 h i(1-μ)[]2h i+1+1+μ[]2.a ib i+ρω2na-ia[]n2(3+μ)(1+μ)(h i+1-h i)[]8hi+1ρω2na-ia[]n4(3+μ)(1-μ)(h i+1-h i)[]16hi+1边界条件为在外边界(r=a)时径向应力为零,可得σr1|r=a=-3+μ[]8ρω2a2+ai[]2+b i[]a2=0在中心处的应力分量为有限值,故b n=0.3.数值算例一实心旋转变厚度圆盘,其厚度h=cr-1μ=0.3,划分单元数n=20,为方便起见,将位移和应力写成如下形式: u=αρω2a3[]e,σr=βρω2a2,σθ=β1ρω2a2,就可以计算出各点的u,σr,σθ,式中各系数α,β,β1的精确解与本文解,如表1所示,再将三组数据比较.从表1可以看出,本文的近似解完全能够获得实际上足够精确的结果. 1α,β,β1本文解与精确解结果对比r[]a[]α[]β[]β 14.结论本文将变厚度匀速旋转的圆盘离散化为若干个等厚度圆盘,利用简单圆盘的应力计算系数和变厚度盘的边界条件,建立待定常数之间的传递矩阵,进而求得旋转变厚度盘的应力与位移解.从实例精确解与本文解的对比可以看出,该方法计算简洁方便、计算精度较高、计算量小,为计算具有任意轮廓的变厚度旋转圆盘的应力与位移提供了较为精确的解法.。