How to create a rank k matrix using MATLAB?

前端 未结 3 665
礼貌的吻别
礼貌的吻别 2021-01-21 18:01

Im looking to create a matrix of rank k. The dimension of the matrix is m x n. The input k satisfies that condition that k < min(

3条回答
  •  感动是毒
    2021-01-21 18:49

    It's not really so clear what you are aiming for.

    But in order to create a matrix B with specific rank k, from a matrix A (with rank at least k), you may like to utilize svd and proceed like:

    >>> A= rand(7, 5);
    >>> rank(A)
    ans =  5
    >>> [U, S, V]= svd(A);
    >>> k= 3;
    >>> B= U(:, 1: k)* S(1: k, 1: k)* V(:, 1: k)';
    >>> rank(B)
    ans =  3
    

提交回复
热议问题