|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
本帖最后由 mytomorrow 于 2020-1-10 10:12 编辑
+ O% u" R( S% {' r- g0 C$ a( k% l9 S7 F8 M2 S+ R* D3 [" f: V E
0 Q0 y' |; P3 N, m4 w4 \pascal
( F- t8 e w) q4 n/ GPascal matrix
- ?& j/ _8 m/ h4 t5 f
' @# O( g6 ~" p8 O, w9 r" O
. T" J* B7 f/ d* Z+ {3 b4 m! FSyntax
9 |8 E# `; s' `' U C: u$ V! `) n9 ^, w7 L+ V K
P = pascal(n)+ t1 X0 v/ X+ _# T: b& g' z
5 E" v5 x' i, H7 |
P = pascal(n,1)4 E5 Z5 Z$ W9 s8 }
2 H. \) }2 N$ N3 F" `. M
P = pascal(n,2)7 k% F- Q, o, `- _: x" w
^" G9 x/ l& Q9 \! K; U
P = pascal(___,classname)
( u ]5 l$ \, E. A2 l) q) K2 P! X4 Q& p* f! ^* J
" H* M: M- T0 K& g, F1 X
Description, l# b" [$ c& X9 F4 D) Z# W
3 L1 a( m5 d k) s. ~; u: p# @+ j
P = 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.* N3 B: x$ d5 }7 e" l
# ]( p3 B- z' xP = pascal(n)返回阶数为n的Pascal矩阵。 P是对称正定矩阵,其整数条目取自Pascal的三角形。 P的倒数具有整数条目。
' u: x/ d( ~1 U3 i) O) {
, k. j+ ^. i! T( _9 p, eP = 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.. g. x o7 A/ J5 A7 k. o
$ f6 n# Y) \8 }7 SP = pascal(n,1)返回Pascal矩阵的下三角Cholesky因子(直到列的符号)。 P是非自愿的,也就是说,它是它自己的逆。# r: ]8 x0 ^# Q$ I9 W! V" f
( s2 z% n! `3 @ x+ l9 Y
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., `9 R0 w, i9 S8 N# F* o5 n. W
4 M7 Q* J2 w1 N% C& `9 w! z
P = pascal(n,2)返回pascal(n,1)的转置和置换版本。 在这种情况下,P是单位矩阵的立方根。
}) F1 L2 C# K( C8 Z P A6 T' I( y5 R" ~
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'.
( P- V. p% S0 C* z
+ |- h* _: z* }- z! }P = pascal(___,classname)使用先前语法中的任何输入参数组合返回类classname的矩阵。 classname可以是'single'或'double'。
4 v+ ^# l% G6 A0 Q
% @( S$ D/ {- ~$ y8 ]" c9 Y; F$ H5 R; O
Matrix from Pascal's Triangle2 f1 Y- R: y, |& A1 m5 Q+ T; S
- L; A9 v! G0 h$ v, A
1 O) ?+ V) `% W( p. ?% h2 FCompute the fourth-order Pascal matrix.
, U( h3 O5 `) L8 B3 N& Z
% C0 S" T! X. l3 mA = pascal(4)7 [* E6 p6 f" g. {+ w3 i
. e* B" B% D/ }
A = 4×4
" V+ k! b: b3 G+ ]6 \, S; M
F& c; o3 S. W3 J 1 1 1 11 r& ~( r' @3 S
1 2 3 4 r& @- X- o3 g% e4 ^
1 3 6 10
- m7 t7 m; F) ` 1 4 10 20
, _: z1 L1 Z/ N# Q
4 R1 A7 ]. J8 J% e1 O& ZCompute the lower triangular Cholesky factor of the third-order Pascal matrix, and verify it is involutory.4 x1 R0 x) e( ]1 [+ M
. R+ G+ W. ]8 c8 a$ J5 U9 mA = pascal(3,1)
- R1 n/ j* }2 f0 }7 @; K) m/ `+ k( G9 i7 T6 p- s/ X/ K
) g' R$ m0 R: Y L, ?' DA = 3×3
/ f4 g- P. P2 C( v2 `( d# P5 `( y! e% C8 J
1 0 0
+ e9 ]/ I* R f8 f/ g4 x O 1 -1 0- f7 I: c* i% m8 O
1 -2 1
: E: J/ R& M3 \4 y0 p7 [. E7 C
inv(A)
6 e) e& s! B) a9 E# i N' \* ?3 ]3 ^) h" `' J( M; t" i; h: s& W
ans = 3×3
1 H+ W* z, g" b6 h' a
6 k4 q8 B+ B9 Q' `8 l/ O 1 0 05 e3 L$ S+ S5 y4 f
1 -1 0
: O- }; R- b2 A$ k( n; o3 N5 T 1 -2 1
" [! l# u& A8 O4 \3 q
3 w" [! ^" B% {- Q1 A$ y帕斯卡的矩阵
) T- f2 ?* C) N/ I+ D8 H% I帕斯卡的三角形是由数字行组成的三角形。 第一行具有条目1.每个后续行通过添加前一行的相邻条目而形成,替换为0,其中不存在相邻条目。 pascal函数通过选择与指定矩阵维度相对应的Pascal三角形部分来形成Pascal矩阵,如图所示。 概述的矩阵对应于MATLAB®命令pascal(4)。2 q5 q0 ?# g& @' l4 b, P0 A$ @
- M) G# T* f" P3 V' X# F
1 ]0 ]1 h; z7 p5 {2 C" ?* F# _3 ]1 C4 _) b5 E
根据上述描述,我们猜测,pascal(3)为:
. o Q4 K: ^; N% r7 y1 T3 U" ^3 K0 _. w8 | P
1 1 18 V a' t4 ^& }( B/ u) \' N; d
8 p5 m7 u8 r) p9 g6 j+ ]% K# X
1 2 3( S7 F% \2 W' d
3 s7 S& n0 Y9 U1 d
1 3 6; T: r7 O$ V J6 g
9 @. y$ O/ _; a; _5 }: m: v
验证下:
6 _# }* c1 c C6 V1 Z- x9 e5 L$ C$ v7 p K1 U7 Q4 b( s1 k
>> pascal(3)% Y8 l- k2 }8 z, i/ J2 @" o; _
/ @8 R; G; [; Y m# X
ans =+ `9 W1 w T! o
7 u" i+ `1 V& o8 @" Q, W+ v* s! P 1 1 1
% y( u$ A6 H6 Z/ N. i+ t$ x! Y 1 2 32 C% @8 ]& n7 b& _7 X
1 3 6: L E1 m |* ?9 O8 o2 k+ {
; A8 D- F2 O, P6 c1 |/ F9 W. ^确实如此!0 S$ a" @' U. N4 ~
- e$ |% G3 n! Y2 e0 _: o
1 _6 I+ l) b9 ^& x/ G, g- w% y |
|