如何在Matlab中使用Gram-Schmidt算法生成具有正交行的随机矩阵 [英] how to generate a random matrix with Orthogonalized rows using Gram-Schmidt algorithm in Matlab

查看:262
本文介绍了如何在Matlab中使用Gram-Schmidt算法生成具有正交行的随机矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在MATLAB中生成具有以下约束的M * N矩阵(M不等于N):

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

步骤1.将矩阵的每个条目设置为一个i.i.d. N(0,1)值.

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

步骤2.使用Gram-Schmidt算法正交化矩阵的M行.

Step 2. Orthogonalize the M rows of the matrix using the Gram-Schmidt algorithm.

第3步.将矩阵的行标准化为单位长度.

Step 3. Normalize the rows of the matrix to unit length.

我不知道如何执行上述第二步.

I do not know how to implement second step of above.

感谢您的帮助.

推荐答案

您可能想看看 orth :

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

这篇关于如何在Matlab中使用Gram-Schmidt算法生成具有正交行的随机矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆