How to create a rank k matrix using MATLAB?

前端 未结 3 624
礼貌的吻别
礼貌的吻别 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条回答
  •  -上瘾入骨i
    2021-01-21 18:51

    A matrix of rank 1 can be created by the outer product of two vectors, for example:

    A = randn(10,1) * randn(1,10);
    

    Add together k of these and you will have a matrix of rank k. Like this:

    >> A = zeros(10);
    >> for i = 1:4, A = A + randn(10,1) * randn(1,10); end
    >> rank(A)
    
    ans =  4
    

提交回复
热议问题