MATLAB Answers

Creating a row vector of noisy data.

조회 수: 6(최근 30일)
Muhammad Ilyas
Muhammad Ilyas 30 May 2020
댓글: per isakson 30 May 2020
How to create a row vector of noisy data from a normal distribution with a mean of 10.0 and a standard deviation of 2.0 to test a program:
noisyData = 10.0+ 2.0 * randn(1,100);

답변(1개)

per isakson
per isakson 30 May 2020
편집: per isakson 30 May 2020
A naive code
noise = 2.0 * randn(1,100);
noise = noise .* (2.0./std(noise));
std( noise )
ans =
2
a bit closer
M = 10;
S = 2;
%%
noise0 = randn(1,100);
s0 = std( noise0 );
m0 = mean( noise0 );
%%
signal = M + S*(noise0-m0)/s0;
%%
s = std( signal );
m = mean( signal );

  댓글 수: 0

댓글을 달려면 로그인하십시오.


Translated by