Gaussian noise in a function

126 ビュー (過去 30 日間)
Katerina
Katerina 2015 年 1 月 2 日
編集済み: Star Strider 2015 年 1 月 2 日
How can I insert gaussian noise additive or multiple in a function, where the variance is unknown and the mean is equal to 1.
  2 件のコメント
John D'Errico
John D'Errico 2015 年 1 月 2 日
Looks like you deleted your last question. My comment still applies. What do you mean when you ask to add (or multiply) by noise where you don't know what the parameters of the noise are?
Katerina
Katerina 2015 年 1 月 2 日
what I mean is that I made a function in which I want to add gaussian noise.... The exact parameters are not given in my exercise... The only thing that I know is that the noise follows the Gaussian distribution with unknown variance...

サインインしてコメントする。

回答 (1 件)

Star Strider
Star Strider 2015 年 1 月 2 日
編集済み: Star Strider 2015 年 1 月 2 日
To create your Gaussian noise, use the randn function.
For an unknown variance, create a variable for it (here ‘varn’). To change the mean, add it. So if your signal is a (Nx1) vector ‘s’, and you want to add Gaussian random noise to it with a mean of 1:
sn = s + sqrt(varn)*randn(N,1)+1;
where ‘sn’ is your signal + noise.
  2 件のコメント
Katerina
Katerina 2015 年 1 月 2 日
編集済み: Star Strider 2015 年 1 月 2 日
like this:???
for varn=1:0.01:5
noise(varn)=sqrt(varn).*randn(1,size(x)); % Create an additive gaussian noisy version of y
yna = y + noise(varn);
Star Strider
Star Strider 2015 年 1 月 2 日
編集済み: Star Strider 2015 年 1 月 2 日
I was thinking of creating your signal with something like this:
varn = 1:0.01:5; % Variance
y = 5*sin(4*pi*varn/5); % Signal
yn = y + sqrt(varn).*randn(size(varn))+1; % Signal + Noise
figure(1)
plot(varn, yn)
grid
You will probably need to experiment with it to get the result you want.
I would use the rand (uniform random numbers on the interval (0,1)) to define ‘varn’, but you may have other requirements. In that instance, the code becomes:
k = 1:0.01:5; % Time (Index) Vector
y = 5*sin(4*pi*k/5); % Signal
varn = rand(size(k)); % Variance Vector
yn = y + sqrt(varn).*randn(size(k))+1; % Signal + Noise
figure(1)
plot(k, yn)
grid

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by