Creating a row vector of noisy data.

2 ビュー (過去 30 日間)
Muhammad Ilyas
Muhammad Ilyas 2020 年 5 月 30 日
コメント済み: per isakson 2020 年 5 月 30 日
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 2020 年 5 月 30 日
編集済み: per isakson 2020 年 5 月 30 日
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 );

カテゴリ

Help Center および File ExchangeSmoothing and Denoising についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by