Main Content

svd

Compute truncated SVD of state-data matrix

Since R2024b

    Description

    Use this function to return a truncated singular value decomposition of the state-snapshot matrix processed in an incrementalPOD object. The truncated SVD is given by:

    XXTUrΣr2UrT

    Here, X is the state snapshot data processed by incremental proper orthogonal decomposition (POD), Σr matrix contains the dominant singular values, and columns of Ur are the corresponding left singular vectors.

    [Ur,Sr] = svd(xPOD) returns the matrices of the truncated SVD of the state-snapshot data processed by xPOD.

    example

    [Ur,Sr] = svd(xPOD,tol) also specifies the relative tolerance for SVD truncation.

    [Ur,Sr] = svd(xPOD,tol,center) also specifies whether to center the state-snapshot. When you set center to true, the function subtracts the mean value of X from X before computing the SVD.

    Examples

    collapse all

    This example show how to obtains a truncated singular value decomposition (SVD) of the state-snapshot matrix processed in an incrementalPOD object.

    Create a random state-space model and run a simulation to collect state data.

    rng(0)
    sys = drss(50);
    t = 0:1:100; 
    u = zeros(size(t)); 
    u(1) = 1;
    [~,~,x] = lsim(sys,u,t);
    X = x';

    Now, perform an incremental POD for the same system using lsim. Incremental POD obtains a low-rank approximation XURVT of the state data obtained during simulation.

    xPOD = incrementalPOD;
    [~,~,~,~,xPOD] = lsim(sys,u,t,xPOD)
    xPOD = 
      incrementalPOD with properties:
    
        Snapshots: 101
          MaxRank: 22
          RankTol: 1.0000e-06
        Transform: []
    
    

    Obtain the truncated SVD of the state date processed by xPOD.

    [Ur1,sr1] = svd(xPOD);
    size(Ur1)
    ans = 1×2
    
        50    22
    
    

    This provides an approximation of rank 22 of XXT with size 50-by-50. You can compare this with the SVD of the state data X obtained previously.

    [Ur2,sr2] = svd(X,"econ","vector");
    [sr1 sr2(1:22)]
    ans = 22×2
    
       61.3554   61.3554
       12.6726   12.6726
        8.6978    8.6978
        5.4812    5.4812
        3.5644    3.5644
        2.2377    2.2377
        1.4885    1.4885
        1.2579    1.2579
        0.8658    0.8658
        0.6777    0.6777
          ⋮
    
    

    Notice that singular values match closely. You can see that incrementalPOD discards the components that contribute below Ranktol specified in xPOD.

    sr2(23:end)/sr2(1)
    ans = 28×1
    10-6 ×
    
        0.5882
        0.2494
        0.0902
        0.0356
        0.0168
        0.0059
        0.0019
        0.0006
        0.0002
        0.0000
          ⋮
    
    
    norm(Ur1'*Ur2(:,23:end))
    ans = 
    7.4155e-14
    

    Input Arguments

    collapse all

    Incremental proper orthogonal decomposition result, specified as an incrementalPOD object.

    Tolerance for SVD truncation, specified as a real scalar between 0 and 1. This value must be larger than the tolerance specified in XPOD.RankTol for meaningful results

    Flag to center the data before computing the SVD, specified as a logical false (0) or true (1).

    Output Arguments

    collapse all

    Left singular vectors in the SVD, returned as a matrix. Ur is a tall orthogonal matrix.

    Singular values in the SVD, returned as a vector.

    Version History

    Introduced in R2024b