how to generate a random matrix with Orthogonalized rows using Gram-Schmidt algorithm in Matlab

前端 未结 1 542
Happy的楠姐
Happy的楠姐 2021-01-20 03:06

I want to generate a M*N matrix (M is not equal to N) with following constraints in MATLAB:

Step 1. Set each entry of the matrix to an i.i.d. N(0,1) value.

S

相关标签:
1条回答
  • 2021-01-20 03:33

    You might want to look at orth:

    A = randn( m, n );  % random iid ~N(0,1)
    oA = orth( A.' ).'; % orthogonal rows
    nA = bsxfun( @rdivide, oA, sqrt( sum( oA.^2, 2 ) ) ); % normalize to unit length
    
    0 讨论(0)
提交回复
热议问题