免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
用MATLAB實(shí)現(xiàn)矩陣分解

MATLAB求解線性方程的過程基于三種分解法則:

(1)Cholesky分解,針對(duì)對(duì)稱正定矩陣;

(2)高斯消元法,  針對(duì)一般矩陣;

(3)正交化,      針對(duì)一般矩陣(行數(shù)≠列數(shù))

這三種分解運(yùn)算分別由chol, lu和 qr三個(gè)函數(shù)來分解.

1. Cholesky分解(Cholesky Decomposition)

僅適用于對(duì)稱和上三角矩陣

例:cholesky分解。

a=pascal(6)

b=chol(a)

a =

     1     1     1     1     1     1

     1     2     3     4     5     6

     1     3     6    10    15    21

     1     4    10    20    35    56

     1     5    15    35    70   126

     1     6    21    56   126   252

b =

     1     1     1     1     1     1

     0     1     2     3     4     5

     0     0     1     3     6    10

     0     0     0     1     4    10

     0     0     0     0     1     5

0     0     0     0     0     1

CHOL   Cholesky factorization.

CHOL(X) uses only the diagonal and upper triangle of X. The lower triangular is assumed to be the (complex conjugate) transpose of the upper.  If X is positive definite, then R = CHOL(X) produces an upper triangular R so that R'*R = X. If X is not positive definite, an error message is printed.

[R,p] = CHOL(X), with two output arguments, never produces an

error message.  If X is positive definite, then p is 0 and R is the same as above.   But if X is not positive definite, then p is a positive integer.

When X is full, R is an upper triangular matrix of order q = p-1

so that R'*R = X(1:q,1:q). When X is sparse, R is an upper triangular matrix of size q-by-n so that the L-shaped region of the first q rows and first q columns of R'*R agree with those of X.

2. LU分解(LU factorization).

用lu函數(shù)完成LU分解,將矩陣分解為上、下兩個(gè)三角陣,其調(diào)用格式為:

[l,u]=lu(a)  l代表下三角陣,u代表上三角陣。

例:

LU分解。

a=[47  24  22; 11  44  0;30  38  41]

[l,u]=lu(a)

a =

    47    24    22

    11    44     0

    30    38    41

l =

    1.0000         0         0

    0.2340    1.0000         0

    0.6383    0.5909    1.0000

u =

   47.0000   24.0000   22.0000

         0   38.3830   -5.1489

         0         0   30.0000

LU     LU factorization.

[L,U] = LU(X) stores an upper triangular matrix in U and a "psychologically lower triangular matrix" (i.e. a product of lower triangular and permutation matrices) in L, so that X = L*U. X can be rectangular.

[L,U,P] = LU(X) returns unit lower triangular matrix L, upper triangular matrix U, and permutation matrix P so that  P*X = L*U.

3. QR分解(Orthogonal-triangular decomposition).

函數(shù)調(diào)用格式:[q,r]=qr(a), q代表正規(guī)正交矩陣,r代表三角形矩陣。原始陣a不必一定是方陣。如果矩陣a是m×n階的,則矩陣q是m×m階的,矩陣r是m×n階的。

例:QR分解.

A=[22  46  20  20; 30  36  46  44;39  8  45  2];

[q,r]=qr(A)

q =

   -0.4082   -0.7209   -0.5601

   -0.5566   -0.2898    0.7786

   -0.7236    0.6296   -0.2829

r =

  -53.8981  -44.6027  -66.3289  -34.1014

         0  -38.5564    0.5823  -25.9097

         0         0   11.8800   22.4896

QR     Orthogonal-triangular decomposition.

[Q,R] = QR(A) produces an upper triangular matrix R of the same

    dimension as A and a unitary matrix Q so that A = Q*R.

[Q,R,E] = QR(A) produces a permutation matrix E, an upper

    triangular R and a unitary Q so that A*E = Q*R.  The column

    permutation E is chosen so that abs(diag(R)) is decreasing.

[Q,R] = QR(A,0) produces the "economy size" decomposition. If A is m-by-n with m > n, then only the first n columns of Q are computed.

4. 特征值與特征矢量(Eigenvalues and eigenvectors).

MATLAB中使用函數(shù)eig計(jì)算特征值和 特征矢量,有兩種調(diào)用方法:

*e=eig(a), 其中e是包含特征值的矢量;

*[v,d]=eig(a), 其中v是一個(gè)與a相同的n×n階矩陣,它的每一列是矩陣a的一個(gè)特征值所對(duì)應(yīng)的特征矢量,d為對(duì)角陣,其對(duì)角元素即為矩陣a的特征值。

例:計(jì)算特征值和特征矢量。

a=[34  25  15; 18  35  9; 41  21  9]

e=eig(a)

[v,d]=eig(a)

a =

    34    25    15

    18    35     9

    41    21     9

e =

   68.5066

   15.5122

   -6.0187

v =

   -0.6227   -0.4409   -0.3105

   -0.4969    0.6786   -0.0717

   -0.6044   -0.5875    0.9479

d =

   68.5066         0         0

         0   15.5122         0

         0         0   -6.0187

EIG    Eigenvalues and eigenvectors.

E = EIG(X) is a vector containing the eigenvalues of a square matrix X.

[V,D] = EIG(X) produces a diagonal matrix D of eigenvalues and a full matrix V whose columns are the corresponding eigenvectors so that X*V = V*D.

[V,D] = EIG(X,'nobalance') performs the computation with balancing

    disabled, which sometimes gives more accurate results for certain

    problems with unusual scaling. If X is symmetric, EIG(X,'nobalance')

    is ignored since X is already balanced.

5. 奇異值分解.( Singular value decomposition).

如存在兩個(gè)矢量u,v及一常數(shù)c,使得矩陣A滿足:Av=cu,  A’u=cv

稱c為奇異值,稱u,v為奇異矢量。

將奇異值寫成對(duì)角方陣∑,而相對(duì)應(yīng)的奇異矢量作為列矢量則可寫成兩個(gè)正交矩陣U,V, 使得: AV=U∑, A‘U=V∑  因?yàn)閁,V正交,所以可得奇異值表達(dá)式:

A=U∑V’。

一個(gè)m行n列的矩陣A經(jīng)奇異值分解,可求得m行m列的U, m行n列的矩陣∑和n行n列的矩陣V.。

奇異值分解用svd函數(shù)實(shí)現(xiàn),調(diào)用格式為;

[u,s,v]=svd(a)  

SVD    Singular value decomposition.

[U,S,V] = SVD(X) produces a diagonal matrix S, of the same dimension as X and with nonnegative diagonal elements in decreasing order, and unitary matrices U and V so that X = U*S*V'.

S = SVD(X) returns a vector containing the singular values.

[U,S,V] = SVD(X,0) produces the "economy size" decomposition. If X is m-by-n with m > n, then only the first n columns of U are computed and S is n-by-n.

例: 奇異值分解。

a=[8  5; 7  3;4  6];

[u,s,v]=svd(a)             % s為奇異值對(duì)角方陣

u =

   -0.6841   -0.1826   -0.7061

   -0.5407   -0.5228    0.6591

   -0.4895    0.8327    0.2589

s =

   13.7649         0

         0    3.0865

         0         0

v =

   -0.8148   -0.5797

   -0.5797    0.8148

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
其他矩陣函數(shù) | 一些MATLAB的更高級(jí)的矩陣函數(shù)
20世紀(jì)十大算法
最小二乘解與極小范數(shù)解算法的C++實(shí)現(xiàn)(支持復(fù)系數(shù)方程組)
特征值分解與奇異值分解(SVD)
高能!8 段代碼演示 Numpy 數(shù)據(jù)運(yùn)算的神操作
5.3.3 矩陣分解
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服