Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

The Mathematica documentation center provides an example of how to add noise to a process: White Noise Process.

\[ScriptCapitalP] = TransformedProcess[
             Cos[t/8] + noise[t], 
             noise \[Distributed] WhiteNoiseProcess[UniformDistribution[{-1/5, 1/5}]],

data = RandomFunction[\[ScriptCapitalP], {0, 200}];
ListPlot[data, Filling -> Axis]

Mathematica graphics

I'm also able to do the same with Gaussian noise, in which case I use NormalDistribution[0, 1] instead of UniformDistribution[{-1/5, 1/5}].

I have now two problems:

  • The first one is that I want the standard derivation to be a function of time, so NormalDistribution[0, f[t]], but this doesn't work.
  • The second problem is that I always get nothing when I choose the variance to be zero, which should effectively correspond to no noise.

Can someone help?

share|improve this question
When I have no noise, so zero mean and zero variance, I should get the original process back again, which I don't. Was only curious about that. – QuantumMechanics Nov 23 at 12:41
Now I see, sorry I wasn't paying close enough attention – sebhofer Nov 23 at 15:33
Mathematica can't handle the (singular) case of $\sigma\rightarrow 0$. Try PDF[NormalDistribution[0, 0], x], which throws the error NormalDistribution::posprm: "Parameter 0 at position 2 in NormalDistribution[0,0] is expected to be positive.". – sebhofer Nov 23 at 17:40

2 Answers 2

up vote 6 down vote accepted

The nice thing about NormalDistribution is that it scales:

In[104]:= TransformedDistribution[sigma*u, 
 u \[Distributed] NormalDistribution[0, 1]]

Out[104]= NormalDistribution[0, Abs[sigma]]

So NormalDistribution[0, f[t]] is equivalent to f[t]*NormalDistribution[0,1], assuming f[t] is positive.

Then just adjust the transformation in TransformedProcess:

proc = 
  TransformedProcess[Cos[t/8] + Sqrt[t]*noise[t], 
  noise \[Distributed] WhiteNoiseProcess[NormalDistribution[0, 1]],t];
data = RandomFunction[proc, {0, 200}];
ListPlot[data, Filling -> Axis]

with the adjusted noise

share|improve this answer
Thanks for your answer. How can I increase the number of points? When I'm using RandomFunction[proc,{0,200,0.2}] I always get an error... – QuantumMechanics Nov 23 at 11:14
That is bc WhiteNoiseProcess in M is a discrete time process and RandomFunction can only output sample on integers. What you can do is to specify the length of the sample and then use TimeSeriesRescale to rescale time stamps to the MinimumTimeIncrement of your choice. – Gosia Nov 23 at 21:51

I don't have any experience with TransformedProcess or RandomFunction, but coulddn't you just make your own noise and add it to the data?

data = Cos[#/8] + 
     RandomVariate[NormalDistribution[0, # .001 + .05]] & /@ 
   Range[0, 200];
ListPlot[data, Filling -> Axis]

enter image description here

share|improve this answer
Thanks for your answer, I will try to implement this later! :-) – QuantumMechanics Nov 20 at 15:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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