I have a vector called x. I want to change elements of the vector which are negative to absolute valu of a gaussian random number with std equal to 1 and mean equal to 0. I used below code but it doesn't work. Could anyone suggest a way to do it?
index = (x < 0); x(index) = abs(rand(1,index));
Aucun commentaire:
Enregistrer un commentaire