EDA365电子论坛网

标题: MATLAB的Pascal matrix 简单介绍 [打印本页]

作者: mytomorrow    时间: 2020-1-10 10:01
标题: MATLAB的Pascal matrix 简单介绍
本帖最后由 mytomorrow 于 2020-1-10 10:12 编辑
; E! v/ W( Q: t6 W
; H* e, Q7 r! b8 Z% v) \: ~. z2 L: |- {7 z: c; @4 n8 t) Q( @8 X
pascal
2 g2 m+ W+ z* V7 W) t8 QPascal matrix$ ^. B9 e+ u! o2 G0 n# A1 u% Y
; G8 W+ t' T2 |4 S. Q
9 A' E2 ^- J5 D& I
Syntax
2 ~5 T- i2 `/ |& y. B( f7 t* O8 G9 E3 t6 f# i
P = pascal(n)
* Y( e, @1 Z! U1 b9 i- `- j7 }+ o6 I& J5 T% f/ N. i+ t
P = pascal(n,1)# J8 q3 L, D# b( H: u% V% b  F
/ i* _) C1 ]& b, p* j) A/ U. [
P = pascal(n,2)
. M6 O; i$ x' v8 N6 |* C
8 W6 p- A2 w3 n0 ^; l) A( n% sP = pascal(___,classname)
* g- G/ T6 W& G! ~7 T" D. Z
1 Y' r8 z4 L! u0 a1 o; M% M
* W) F: _, A  {' g/ H7 p9 M( eDescription, T3 {$ ?' d* g$ I" d' j

" v( _. G: q: C( O8 g& FP = 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./ `( Q2 k! t6 S4 ?1 t5 K
  N8 e  S  k% H; A3 v
P = pascal(n)返回阶数为n的Pascal矩阵。 P是对称正定矩阵,其整数条目取自Pascal的三角形。 P的倒数具有整数条目。
. s6 B$ \3 J) f  Q
+ F1 K; Y, w' o  t( D3 hP = 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.
2 s1 V3 s6 D, i/ A4 E* ]+ R: ~* R5 x" {2 w, x
P = pascal(n,1)返回Pascal矩阵的下三角Cholesky因子(直到列的符号)。 P是非自愿的,也就是说,它是它自己的逆。
; U2 V( g& c9 ?8 c7 k2 }  m$ J% r2 S+ f* ~* [
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.: p0 H6 n0 g& E, U8 ?) U& X, {

( j2 O9 h3 D1 K" ~$ xP = pascal(n,2)返回pascal(n,1)的转置和置换版本。 在这种情况下,P是单位矩阵的立方根。8 Y7 y2 C( r, N; q, [

$ T3 N7 g8 b( _! M6 d5 B3 J3 {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'.; O" P. @; W2 T! J) [
+ B) }( V/ h9 R) ?& _
P = pascal(___,classname)使用先前语法中的任何输入参数组合返回类classname的矩阵。 classname可以是'single'或'double'。4 m/ `7 L. t/ Q, }/ G8 B- `

/ o6 A8 H" i' l3 C3 C) T3 p( u8 `8 X4 e
Matrix from Pascal's Triangle
9 F( q. e1 X0 o) i# U4 B' }* j) ^1 A5 ?

9 Z6 y4 v) ?8 A, p, q+ k- ?Compute the fourth-order Pascal matrix.& _3 S& X! P; D

( }) Y" Q) x0 s6 `' l6 k, KA = pascal(4)$ G8 g1 m- v# T6 \4 \% r

7 E! B  R& I+ y+ P7 c" L, [) [A = 4×4
! h' l2 j- |6 R4 J2 f, ^
4 _1 v9 o8 C$ M+ E- T6 z* O. V     1     1     1     18 y* q* b/ T; u4 M/ z
     1     2     3     42 v" g) ?% W6 L
     1     3     6    10
. z" `) c2 o+ n4 r) H+ g( x8 Q     1     4    10    20
+ T6 e# b$ `$ {0 E: w3 M
3 W# m0 j0 y6 a- J% qCompute the lower triangular Cholesky factor of the third-order Pascal matrix, and verify it is involutory.1 M6 ~4 l( l+ D% C

2 c& E& y) R& e0 L9 ]4 }A = pascal(3,1)' |# `. q' H" f

5 {7 `% I5 y9 C( e. i3 N. T" k$ `4 l% O/ |. j
A = 3×3
4 r" r9 T; \/ O( o
  Q: N" q6 v$ b     1     0     0
; p/ o4 i$ R( r" e- _) L     1    -1     0
& N% k3 j; u- c8 c( n     1    -2     1$ \% }2 ?7 ]5 u$ G! \
! h8 H: h: O& X% k; y9 b% ~
inv(A)
4 s; ^! T3 V: C- _5 i% X, H" O! c. r# E6 _5 o; c
ans = 3×3, i1 F; K# O4 _( M  Q8 e# z3 ^

) x. U( g3 F( j5 P! {7 s     1     0     0, F1 G; c' g8 S1 ^3 }
     1    -1     0
1 f$ p! G# a: {9 j     1    -2     1
' c6 v9 ?2 _0 ?+ t  D( p7 x0 Y( Q5 y9 c# G" I
帕斯卡的矩阵* U* \4 |% G9 V1 G- {7 J" {
帕斯卡的三角形是由数字行组成的三角形。 第一行具有条目1.每个后续行通过添加前一行的相邻条目而形成,替换为0,其中不存在相邻条目。 pascal函数通过选择与指定矩阵维度相对应的Pascal三角形部分来形成Pascal矩阵,如图所示。 概述的矩阵对应于MATLAB®命令pascal(4)。
( J# v* X$ @" Q6 A7 i
9 F( ~3 N: p+ [/ E/ ]) V 2 t) f6 P2 L* [
" v+ h' q0 T  ~) @$ K+ }
根据上述描述,我们猜测,pascal(3)为:
: P6 R( t& z1 `3 r: D' k1 ]5 D# g* Z) u* q" S
1  1  1
& x( d$ [! \5 l3 E" ]0 M  y, j5 M7 X, c3 G6 }0 G3 @3 @$ }: R
1  2  3
  Z5 U( M* c; V( v& B0 n7 d9 o
/ t/ ~, k6 P* y2 k+ x# H1  3  6) |  [- v: w6 d0 Q1 w3 H5 v
# l, V. ?4 M3 F& H: P! |; w
验证下:
8 E$ d% H! J7 A8 T  v
3 Y! G% l' a$ @. p>> pascal(3)
. {. h' G) r  I; s
+ \1 s# g2 {* @4 e& a6 ?2 ]ans =
  a# r" q8 a8 r- m! ^+ R: @! l5 S4 ~! Z# v# X! W% d
     1     1     1! Q5 P% r9 t2 Z4 W3 H
     1     2     33 l8 b. X5 U/ n/ s/ ?/ ~, u3 H
     1     3     6
# O: ?2 u/ Q  u9 R: P. R# g# l- u+ }2 \
确实如此!
# g5 e. @2 D1 N
4 a, u( ]: b- X* t# E# h
4 d9 i# f9 i* k4 ~1 B! f6 z
作者: xixihahaheihei    时间: 2020-1-10 17:48
MATLAB的Pascal matrix 学习




欢迎光临 EDA365电子论坛网 (https://bbs.eda365.com/) Powered by Discuz! X3.2