⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 diary

📁 胡广书著的《现代信号处理教程》一书的例子的源码。都是Matlab程序。
💻
📖 第 1 页 / 共 4 页
字号:
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000
    1.0000

cond(a)

ans =

  5.0482e+011

tic; x1 = b'/a; t1 = toc

t1 =

    0.0310

er1 = norm(x-x1')

er1 =

  139.8326

tic; x1 = a\b; t1 = toc

t1 =

     0

tic; x1 = a\b; t1 = toc

t1 =

    0.0160

er2 = norm(x-x1)

er2 =

  1.6645e-004

a = [1 2 3;4 5 6; 2 34 5];
inv(a)

ans =

   -0.9781    0.5027   -0.0164
   -0.0437   -0.0055    0.0328
    0.6885   -0.1639   -0.0164

a1 = det(a)

a1 =

   183

b = magic(3)

b =

     8     1     6
     3     5     7
     4     9     2

b = magic(3)

b =

     8     1     6
     3     5     7
     4     9     2

b = magic(4)

b =

    16     2     3    13
     5    11    10     8
     9     7     6    12
     4    14    15     1

logm(b)

ans =

   0.6902 - 0.2176i  -5.1702 + 0.5132i   5.8379 + 0.8088i   2.1685 - 1.1045i
  -5.1702 - 0.0136i -13.9873 + 0.0322i  16.8460 + 0.0507i   5.8379 - 0.0693i
   5.8379 - 0.2449i  16.8460 + 0.5776i -13.9873 + 0.9103i  -5.1702 - 1.2430i
   2.1685 + 0.4761i   5.8379 - 1.1230i  -5.1702 - 1.7699i   0.6902 + 2.4167i

c = logm(b)

c =

   0.6902 - 0.2176i  -5.1702 + 0.5132i   5.8379 + 0.8088i   2.1685 - 1.1045i
  -5.1702 - 0.0136i -13.9873 + 0.0322i  16.8460 + 0.0507i   5.8379 - 0.0693i
   5.8379 - 0.2449i  16.8460 + 0.5776i -13.9873 + 0.9103i  -5.1702 - 1.2430i
   2.1685 + 0.4761i   5.8379 - 1.1230i  -5.1702 - 1.7699i   0.6902 + 2.4167i

sqrtm(c)

ans =

   1.4880 + 0.2310i  -0.0810 + 1.0290i   0.3871 - 0.6480i   0.0838 - 0.6120i
  -0.1237 + 0.8772i   0.9161 + 2.6525i   0.7696 - 2.6286i   0.3158 - 0.9010i
   0.3016 - 0.9517i   0.8124 - 2.4768i   0.9874 + 2.9056i  -0.2235 + 0.5229i
   0.2121 - 0.1565i   0.2303 - 1.2047i  -0.2662 + 0.3711i   1.7017 + 0.9901i

sqrtm(b)

ans =

   3.7584 - 0.2071i  -0.2271 + 0.4886i   0.3887 + 0.7700i   1.9110 - 1.0514i
   0.2745 - 0.0130i   2.3243 + 0.0306i   2.0076 + 0.0483i   1.2246 - 0.0659i
   1.3918 - 0.2331i   1.5060 + 0.5498i   1.4884 + 0.8666i   1.4447 - 1.1833i
   0.4063 + 0.4533i   2.2277 - 1.0691i   1.9463 - 1.6848i   1.2506 + 2.3006i

eig(b)

ans =

   34.0000
    8.9443
   -8.9443
    0.0000

[x, y] = eig(b)

x =

   -0.5000   -0.8236    0.3764   -0.2236
   -0.5000    0.4236    0.0236   -0.6708
   -0.5000    0.0236    0.4236    0.6708
   -0.5000    0.3764   -0.8236    0.2236


y =

   34.0000         0         0         0
         0    8.9443         0         0
         0         0   -8.9443         0
         0         0         0    0.0000

help eigs

 EIGS  Find a few eigenvalues and eigenvectors of a matrix using ARPACK.
    D = EIGS(A) returns a vector of A's 6 largest magnitude eigenvalues.
    A must be square and should be large and sparse.
 
    [V,D] = EIGS(A) returns a diagonal matrix D of A's 6 largest magnitude
    eigenvalues and a matrix V whose columns are the corresponding eigenvectors.
 
    [V,D,FLAG] = EIGS(A) also returns a convergence flag.  If FLAG is 0
    then all the eigenvalues converged; otherwise not all converged.
 
    EIGS(A,B) solves the generalized eigenvalue problem A*V == B*V*D.  B must
    be symmetric (or Hermitian) positive definite and the same size as A.
    EIGS(A,[],...) indicates the standard eigenvalue problem A*V == V*D.
 
    EIGS(A,K) and EIGS(A,B,K) return the K largest magnitude eigenvalues.
 
    EIGS(A,K,SIGMA) and EIGS(A,B,K,SIGMA) return K eigenvalues based on SIGMA:
       'LM' or 'SM' - Largest or Smallest Magnitude
    For real symmetric problems, SIGMA may also be:
       'LA' or 'SA' - Largest or Smallest Algebraic
       'BE' - Both Ends, one more from high end if K is odd
    For nonsymmetric and complex problems, SIGMA may also be:
       'LR' or 'SR' - Largest or Smallest Real part
       'LI' or 'SI' - Largest or Smallest Imaginary part
    If SIGMA is a real or complex scalar including 0, EIGS finds the eigenvalues
    closest to SIGMA.  For scalar SIGMA, and also when SIGMA = 'SM' which uses
    the same algorithm as SIGMA = 0, B need only be symmetric (or Hermitian)
    positive semi-definite since it is not Cholesky factored as in the other cases.
 
    EIGS(A,K,SIGMA,OPTS) and EIGS(A,B,K,SIGMA,OPTS) specify options:
    OPTS.issym: symmetry of A or A-SIGMA*B represented by AFUN [{0} | 1]
    OPTS.isreal: complexity of A or A-SIGMA*B represented by AFUN [0 | {1}]
    OPTS.tol: convergence: Ritz estimate residual <= tol*NORM(A) [scalar | {eps}]
    OPTS.maxit: maximum number of iterations [integer | {300}]
    OPTS.p: number of Lanczos vectors: K+1<p<=N [integer | {2K}]
    OPTS.v0: starting vector [N-by-1 vector | {randomly generated by ARPACK}]
    OPTS.disp: diagnostic information display level [0 | {1} | 2]
    OPTS.cholB: B is actually its Cholesky factor CHOL(B) [{0} | 1]
    OPTS.permB: sparse B is actually CHOL(B(permB,permB)) [permB | {1:N}]
 
    EIGS(AFUN,N) accepts the function AFUN instead of the matrix A.
    Y = AFUN(X) should return
       A*X            if SIGMA is not specified, or is a string other than 'SM'
       A\X            if SIGMA is 0 or 'SM'
       (A-SIGMA*I)\X  if SIGMA is a nonzero scalar (standard eigenvalue problem)
       (A-SIGMA*B)\X  if SIGMA is a nonzero scalar (generalized eigenvalue problem)
    N is the size of A. The matrix A, A-SIGMA*I or A-SIGMA*B represented by AFUN is

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -