How do i add normal error to some ideal values ?

Hello,
I have a set of ideal -error free- measurements and i want to add some error to them to simulate measurement error (noise etc). I want to know how to add an error with a known standard deviation.
X is the ideall measurements. σ is the standard deviation of the error measurement - known e - error
Xreal = X + e
Xreal = X + σ^2*randn(1) ?
this is not right becouse i will have only positive errors...
please help needed!!

 採用された回答

Wayne King
Wayne King 2012 年 6 月 2 日

1 投票

Assume x is your error-free data
x = cos(pi/4*(0:99));
% now add the error, let the standard deviation be 2
x = x+ 2*randn(size(x));
You do not want to multiply randn() by the variance, you multiply by the standard deviation.

2 件のコメント

Valeriu
Valeriu 2012 年 6 月 2 日
Thanks a lot for the answer!!
ANetTow
ANetTow 2012 年 7 月 17 日
Is there any difference between using randn as above or using random? For example, using the same items from above:
x = random('norm', x, 2);

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

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by