How to add random Noise between 2% in the dataset
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello I Hope you are doing well.
I have the following dataset. I Want to add random noise 2% in the data. How can i do that in MATLAB.
I also want to randomly select the noise between 0.5 to 2%.
Can anybody help me in this
댓글 수: 2
Walter Roberson
2022년 3월 18일
Should the random noise be up to 2% of the maximum absolute value? So with the maximum value being 1000, should the noise at every location be up to 20 in absolute value?
Or should the noise at each point be proportional to the value that is stored in that point? So the places that are (say) 3 would be changed to no more than 3.06 ?
답변 (1개)
Jeff Miller
2022년 3월 17일
Do you mean that you want to multiply each value in the dataset by a random number between 1.005 and 1.02, with all random numbers equally likely in that range? This could be done with something like:
multiplier = 1.005 + rand(size(values))*(1.02-1.005);
values = values *. multiplier;
댓글 수: 5
Walter Roberson
2022년 3월 18일
Suppose you have a value, x, and you want to add to it a value that is between 0% and 2% of x.
Let r denote a random variable in the range [0, 1]. Then between 0% and 2% of x is r * (2/100) * x which is . Now let us add this value to x getting . Both terms involve x, so factor that out, getting which is between and . Which is between and x * 1.02 . Hence if you pick a random number in the range 1 to 1.02 and multiply it by the original value, you will get the same result as if you had specifically decomposed into an addative term and added it to the original value.
When you are adding to a value another value that is linearly proportionate to the original value, then you can express the whole thing as a multiplication by (1 + quantity)
Jeff Miller
2022년 3월 18일
@Stephen john Sorry I am not following you. Maybe you could give a few numerical examples?
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!