Millisecond Forums

## add spatial gaussian noise

https://www.millisecond.com/forums/Topic29470.aspx

 By nakayama - 7/21/2020 Hi, DaveI wish to ask whether it is possible to add a gaussian distributed noise to the values. errordis which is defined as the distance between the clicked position and the start position.For example, If the values.errordis is 500 pixel. I wish to add a gaussian noise centered on 500 pixel  with a standard deviation of 10 pixel.So the final recorded value is, say, 505, due to the added noise.My file is attached below.Thank you for your attention. By Dave - 7/21/2020 +x nakayama - 7/21/2020Hi, DaveI wish to ask whether it is possible to add a gaussian distributed noise to the values. errordis which is defined as the distance between the clicked position and the start position.For example, If the values.errordis is 500 pixel. I wish to add a gaussian noise centered on 500 pixel  with a standard deviation of 10 pixel.So the final recorded value is, say, 505, due to the added noise.My file is attached below.Thank you for your attention.https://www.millisecond.com/support/docs/v5/html/language/functions/randgaussian.htmI.e. something like this:/ columns=[values.errordis values.errordis_plus_noise]/ separatefiles = true/ax=0/ay=0/errordis=0/errordis_plus_noise=0/ initialx=960/ initialy=600/ ontrialend = [trial.click.resetstimulusframes()]/ validresponse = (screen)/ stimulustimes = [0=screen,posx,posy,pose]/ ontrialend = [values.errordis = sqrt(pow(trial.click.responsex-values.initialx,2)+pow(trial.click.responsey-values.initialy,2))]/ ontrialend = [    values.errordis_plus_noise = randgaussian(values.errordis, 10);]/ ontrialend = [values.ax=trial.click.responsex; values.ay=trial.click.responsey]/ responseinterrupt = frames/ inputdevice = mouse/ screencapture = true