How to add random Noise between 2% in the dataset

1 visualización (últimos 30 días)
Stephen john
Stephen john el 17 de Mzo. de 2022
Comentada: Jeff Miller el 18 de Mzo. de 2022
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 comentarios
Walter Roberson
Walter Roberson el 18 de Mzo. de 2022
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 ?
Stephen john
Stephen john el 18 de Mzo. de 2022
@Walter Roberson if you share for both methods ,i will be very grateful

Iniciar sesión para comentar.

Respuestas (1)

Jeff Miller
Jeff Miller el 17 de Mzo. de 2022
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 comentarios
Walter Roberson
Walter Roberson el 18 de Mzo. de 2022
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
Jeff Miller el 18 de Mzo. de 2022
@Stephen john Sorry I am not following you. Maybe you could give a few numerical examples?

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by