symrandn.m

来自「matlab仿真实现无线传感器网络定位算法」· M 代码 · 共 6 行

M
6
字号
% Generate a Normal random matrix of size k, but with zero diagonal
% and ensure the matrix is symmetric (noise(i,j) == noise(j,i)).
function [noise] = symrandn(k)

temp = tril(randn(k),-1);
noise = temp + temp';

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?