add_noise.m

来自「分数阶Fourier变换程序」· M 代码 · 共 28 行

M
28
字号
function y = add_noise(x,std,rc)% add_noise -- add white, guassian noise to a signal% %  Usage%    y = add_noise(x, std, rc)%%  Inputs%    x    signal%    std    standard deviation of the noise (real and/or imaginary parts)%    rc   'real' or 'complex' specifies real or complex noise (optional,%         default is 'complex')%%  Outputs%    y    signal with noise% Copyright (C) -- see DiscreteTFDs/Copyrighterror(nargchk(2,3,nargin));if (nargin<3)  rc = 'complex';endif (rc(1) == 'r')  y = x + std*randn(size(x));else  y = x + std*(randn(size(x)) + i*randn(size(x)));end

⌨️ 快捷键说明

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