how do I add gaussian white noise with 0 mean and 1 std?
Show older comments
i need the noise to be based on the signal
3 Comments
dpb
on 28 Jul 2013
Say what????
N(0,1) --> randn; what's the problem?
Image Analyst
on 29 Jul 2013
"based on"??? Do you mean "added onto"? If the mean is 0, and the std dev is 1, then you have nothing left to control that would let it be dependent on your signal in any way.
dpb
on 29 Jul 2013
precisely...
Answers (1)
Azzi Abdelmalek
on 28 Jul 2013
Edited: Azzi Abdelmalek
on 28 Jul 2013
moyenne=0; % mean
ecart_type=1; % std
t=0:0.1:10
signal=10*sin(t) % your signal
noise= moyenne + ecart_type*randn(1,numel(signal));
out=signal+noise; % for example
plot(out)
4 Comments
dpb
on 29 Jul 2013
My question was/is what did OP mean with "need the noise to be based on the signal" while adding N(0,1) (which your answer does)? The question makes no sense.
asad asad
on 29 Jul 2013
dpb
on 29 Jul 2013
Then scale by the magnitude of the signal by some form...if you want the noise to be some percentage of the signal pk-pk, say, then adjust the sampled variance in proportion.
Azzi Abdelmalek
on 30 Jul 2013
Edited: Azzi Abdelmalek
on 30 Jul 2013
moyenne=0; % mean
t=0:0.1:10 % time
signal=10*sin(t) % your signal
ecart_type=abs(signal*.05) % variable std 5%
noise= moyenne + ecart_type.*randn(1,numel(signal));
out=signal+noise;
plot(out)
Categories
Find more on Measurements and Feature Extraction in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!