I would like to generate data in Mathematica that follows a sinusoidal curve. However, I would like to add a Gaussian noise to the curves so as to reproduce graphs similar this:

enter image description here

I have checked posts related to adding noise to data but am still unsure on how to do this. Any help would be appreciated!

CONTEXT These graphs represent the intensity-phase uncertainties of different quantum states. The first corresponds to the same uncertainty for both the number (amplitude of coherent states) and phase uncertainties, whilst the following two on the right depicts squeezing in one variable and an increased uncertainty in the other conjugate variable in a manner that obeys the Heisenberg uncertainty principle.

Although coherent states (laser light) have a Poissonian distribution in their photon time arrivals, the distribution of the electric field with varying phases will be Gaussian distributed.

  • $\begingroup$ What have you got so far? Please add code to the question. What types of noise do you have in mind? What are the pictures you posted, what do they represent, where di you take them from? $\endgroup$
    – corey979
    Jan 20, 2018 at 19:21
  • $\begingroup$ @corey979, see context in updated question, $\endgroup$
    – Sid
    Jan 20, 2018 at 21:07

1 Answer 1


As @corey979 states, you really need to give more details.

Below is a set of guesses:

n = 10000
e = RandomVariate[NormalDistribution[0, 0.2], n];
data1 = Table[{-π/2 + (7 π/2) i/n, Cos[-π/2 + (7 π/2) i/n] + e[[i]]}, {i, n}];
data2 = Table[{-π/2 + (7 π/2) i/n, Cos[-π/2 + (7 π/2) i/n] + 
     e[[i]] (1 - Abs[Cos[-π/2 + (7 π/2) i/n]])^(1/2)}, {i, n}];
data3 = Table[{-π/2 + (7 π/2) i/n, Cos[-π/2 + (7 π/2) i/n] + 
     Abs[Cos[-π/2 + (7 π/2) i/n]] e[[i]]}, {i, n}];
GraphicsRow[{ListPlot[data1, PlotStyle -> White, Background -> Black],
  ListPlot[data2, PlotStyle -> White, Background -> Black],
  ListPlot[data3, PlotStyle -> White, Background -> Black]}]

Cosine plots with noise

  • $\begingroup$ A Gaussian uncertainty noise was indeed what I was searching for. How is this achieved for say the data1 table? I don't follow why the tables have the x and y entries that you have written $\endgroup$
    – Sid
    Jan 20, 2018 at 21:10
  • 2
    $\begingroup$ I am not a physicist and your added technical terms/jargon to the question certainly does not reduce the (Heisenberg) uncertainty for me. I simply added noise to the amplitude of a cosine. You mention "varying phases" but no phase was used or harmed my figures. The figures I provided just "mimic" what you displayed. To paraphrase @corey979 's request: you'll need to supply details of the model you want to show which would necessarily include specific terms for the sinusoidal, Poisson, and Gaussian terms. $\endgroup$
    – JimB
    Jan 21, 2018 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.