|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本帖最后由 mytomorrow 于 2020-1-10 10:12 编辑
9 t( F% a' C6 Q" d7 Z" z
5 B' c# D5 q; V& |* g* I
4 Z4 u- D% V" ~7 tpascal
4 y" {4 A: s' [1 g5 ZPascal matrix: t* W# r, j% ~- Q- Z! z
. _ ~# b% Q0 F1 Z
1 P" S" Q/ k6 S* s8 t7 E" k
Syntax3 y, s. O% a: N" e
4 i# h" _8 M. V9 I* w6 @
P = pascal(n), f) D8 C& I! P" L, |( S/ K* L
7 c# l$ e/ f, f: Q3 R) LP = pascal(n,1)
* v% M, ~4 C2 s" y
1 O6 K; y9 ^' c2 _% JP = pascal(n,2); @* c8 f& p0 N4 P$ Q! A4 V( u
2 N0 z8 t7 {1 I4 Z2 U) Z
P = pascal(___,classname)3 j) `; N1 E) f' E" }* d$ D! E% }
4 ^! W3 |, {0 l- M& V0 X: x9 D; V' o9 o& I
Description
4 e- C' i! }3 o- c1 Z
1 d& Y+ B" b: vP = pascal(n) returns a Pascal’s Matrix of order n. P is a symmetric positive definite matrix with integer entries taken from Pascal's triangle. The inverse of P has integer entries.
/ B! x: K5 p& h$ x0 D5 @2 n2 x# Q; Y( x; M! K, U: c
P = pascal(n)返回阶数为n的Pascal矩阵。 P是对称正定矩阵,其整数条目取自Pascal的三角形。 P的倒数具有整数条目。
3 P7 ^9 u1 b, C4 Y) ?/ M, i% u1 O
$ ?$ z) y7 h" ?) U+ U! {P = pascal(n,1) returns the lower triangular Cholesky factor (up to the signs of the columns) of the Pascal matrix. P is involutary, that is, it is its own inverse.
' w% Y, P2 R# o
5 }; g3 \) M# D- JP = pascal(n,1)返回Pascal矩阵的下三角Cholesky因子(直到列的符号)。 P是非自愿的,也就是说,它是它自己的逆。: K" r/ P) S) T0 w
+ s" o f( u2 I( H
P = pascal(n,2) returns a transposed and permuted version of pascal(n,1). In this case, P is a cube root of the identity matrix.% f- f$ x- v- _* C0 }7 f6 R
; g& `" s! S1 T, s% u# d& x
P = pascal(n,2)返回pascal(n,1)的转置和置换版本。 在这种情况下,P是单位矩阵的立方根。
A2 v$ J* E" p- c" g& N% V: @( |. K. w0 Q* O: c
P = pascal(___,classname) returns a matrix of class classname using any of the input argument combinations in previous syntaxes. classname can be 'single' or 'double'.
- s; T. q3 _/ E7 q) U/ f- O0 {
6 z* u. N/ w* |. c4 ~* V5 vP = pascal(___,classname)使用先前语法中的任何输入参数组合返回类classname的矩阵。 classname可以是'single'或'double'。
! S" }( P1 i4 E1 F6 K# k B9 T" S; L: @3 V5 ?/ @# c
s3 s+ O. C( O$ d8 W! S
Matrix from Pascal's Triangle
+ c2 H7 O. S4 t: {( @8 e
' c$ f; ` o% Z2 j' Q5 B" p; A0 \% i9 w0 x6 h% g3 q
Compute the fourth-order Pascal matrix.
# K5 D( P! g2 K7 W2 c% _$ i) \$ y* e3 U, i0 x' Q
A = pascal(4)! B4 @, W6 O! m
0 [8 C; L; k; L, h: ?A = 4×4
7 }7 K. ]7 m* x6 w$ \7 T% n2 v# J) Q, L
1 1 1 1
9 o3 z4 m4 a( ]' |8 l# U 1 2 3 4* Z& ]6 T! c) D, I0 m6 s" o8 j
1 3 6 10( s. j( ]3 s1 O4 I; F* |6 H2 g) R6 y1 u
1 4 10 20
. V% P& E5 N7 `/ c, `2 [+ r
$ o8 X5 i; W5 ?; U1 TCompute the lower triangular Cholesky factor of the third-order Pascal matrix, and verify it is involutory.& H. P- S. @6 q! g
; \+ ]; U0 g' q2 P6 G, @
A = pascal(3,1)
4 }0 ~+ f( Q3 C2 O+ u" I9 T* e9 h! @
# Q7 j7 c6 N/ Z% i% k! j4 Z8 _2 @* y; o
A = 3×3
7 Y& p/ [8 F$ [- }, {( {! l
Q4 ?' Q4 B5 E9 r3 ]2 p% Y" [ 1 0 0! X; W) [$ |; K& Z* D: M( i* |$ U
1 -1 0
/ ]: o! s4 a7 K4 }' K# d9 P8 a 1 -2 1
0 F% d4 O: w' I- v! I5 b5 D0 N6 U K8 R1 {
inv(A), V; b: m8 f$ @9 X- J0 K
8 t' M. z& f; G( G
ans = 3×3. `" L3 x2 L9 M
9 |3 t0 {3 O) d/ { 1 0 0 x5 Z4 C: E% I- u
1 -1 0& o: [: t3 P a+ r, l: B1 {$ n9 J
1 -2 1& ^0 w' V& \2 s% q
' [9 X* @ g3 A/ @6 f! ^
帕斯卡的矩阵$ Q6 s' D$ p# t& j0 h( x
帕斯卡的三角形是由数字行组成的三角形。 第一行具有条目1.每个后续行通过添加前一行的相邻条目而形成,替换为0,其中不存在相邻条目。 pascal函数通过选择与指定矩阵维度相对应的Pascal三角形部分来形成Pascal矩阵,如图所示。 概述的矩阵对应于MATLAB®命令pascal(4)。
$ v* s% L' o6 N+ X
) Q3 `2 I) G# r2 K
. z4 O2 g3 m/ d) ^4 F2 Y/ Q1 D" S
( i, U% l3 k8 s" G& ~$ L
根据上述描述,我们猜测,pascal(3)为:
1 j; ^. f! {1 M8 \( E- s) R, Q: W' q1 L5 F6 p
1 1 1, O) z, i* v) M9 E7 {
5 I; K, D" V& W) W' m J1 2 3
?8 y8 a- e% C* K- N
5 s4 Y$ Y1 W7 ~# {1 3 6+ G( Y$ W% y& n% z Y
2 \+ R& {2 T- {
验证下:
5 O4 i3 W7 I9 \3 Z; b5 ^/ q% @/ S( c
>> pascal(3)/ Q1 x: ]0 A* q
' I* o' M# J" Mans =
0 t: [2 M3 O7 r6 T
. |+ A: e! T2 ^: J) U 1 1 1+ d5 c" `( O) p8 ]
1 2 34 r0 w: r6 O, e& H# U
1 3 6
2 O% K8 V7 G/ b6 `" _3 Z+ J
$ I1 s1 O/ B, t确实如此!' n( Q8 n* f5 j% B5 x' |9 O
& u2 I) I$ w9 g8 w, t- F, i) v
; {2 x: Y. ~( G6 Z' H4 s
|
|