9
\$\begingroup\$

I'm trying to simulate noise in my circuit, and ideally want to get a histogram of a certain parameter affected by that noise over many runs. However, when I use the white() command in LTspice, or variations of rand(), I get the same result from run-to-run. Is there a way to randomize the seed so that I get different white noise every iteration?

Thanks!

\$\endgroup\$
4
  • \$\begingroup\$ This is a very interesting question and providing a histogram makes it seem like you're trying to predict noise in a circuit. I believe you could be getting the same results is because the simulations likely assume that the circuit is always initially untouched and unadulterated. I don't think there are options to provide a "seed" for your noise analysis. There's a similar question that's been asked here. Maybe that can help. \$\endgroup\$
    – user103380
    Commented Nov 25, 2019 at 17:13
  • \$\begingroup\$ Use the rand() to vary the starting point of your .tran simulation. \$\endgroup\$ Commented Nov 25, 2019 at 17:25
  • \$\begingroup\$ LTspice can read an external WAV file, though writing your own controllable noise generator and putting it in via a file seems a very clunky way of going about it. Similarly, you could create an m-sequence in the simulation. Several instances of white() delayed by different amounts and added together might get you sufficiently different noise simulations. \$\endgroup\$
    – Neil_UK
    Commented Nov 25, 2019 at 17:26
  • 1
    \$\begingroup\$ Use the .STEP card and create a LIST of values that you add to white(). Then each run would start at a different place in the sequence. Log data and process. You could also use a PWL file with .TRAN if you wanted to do make changes every so often to the base seed you use in white(), which might allow a single run to start at different "places" so that an overall accumulation appears like what you want. Also see this article. If you write what you need, perhaps a better answer? \$\endgroup\$
    – jonk
    Commented Nov 25, 2019 at 18:41

2 Answers 2

2
\$\begingroup\$

What you want to do is called a monte carlo simulation, LT Spice is limited here compared to comercial products as, as far as I know, only 3 parameters can be varied at the same run, but to me it always was sufficient.

just googled a tutorial: http://electronicsbeliever.com/monte-carlo-simulation-using-ltspice-step-by-step-tutorials/

but you will find many more...

\$\endgroup\$
1
  • \$\begingroup\$ The limit on the number of .stepped values is <strike>2</strike> 3 (you were right), but it can be circumvented to any numer by using table() (a bit cumbersome, but certainly not impossible). Also, for OP's case, you don't need to use more than one parameter: white(x+time) with .param x=mc(a,b) (a and b being some numbers). \$\endgroup\$ Commented Aug 23, 2020 at 14:23
1
\$\begingroup\$

You can use a combination of .step commands together with WHITE as shown below.

LTSpice circuit

In effect this starts the run from different points in time. The output voltage in this example is as below.

Output

Thanks to Jonk for this answer in comments. Added here in case linked page moves.

\$\endgroup\$

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.