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!!
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개)

제품

질문:

2012년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by