PDF in Spice

Apr 28, 2015 15 Replies

I've had a few instances where I was interested in seeing the probability density function of a waveform, the voltage histogram, in LT Spice. I never came up with a decent way to display that within Spice. Any ideas?


John Larkin Highland Technology, Inc picosecond timing laser drivers and controllers jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

You could make a subcircuit with a bunch of switches, capacitors, and current sources, which would integrate the amount of time the voltage spent between thresholds N and N+1.

It would get a bit clunky if you wanted more than about a dozen levels, of course.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net

Yeah, brute force. A quantizer and a decoder could fake a mess of window comparators, and integrators are easy, but a nice histogram display is messy.

I have done a single swept window comparator that scans the test waveform, but run times get insane.

I guess the thing to do is export the waveform to a file and analyze it with some other software. Seems inelegant.

John Larkin Highland Technology, Inc picosecond timing laser drivers and controllers jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

Transient analysis in Spice has no noise. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Not as inelegant as having MANY advantages.

You know this sequence, but here it is for 'lurkers':

In LTspice, set .options plotwinsize=0 to catch ALL the waveform

use LTsputil.exe to make all the samples uniformly spaced, I use a batch file to expedite.

Export the resulting evenly spaced trace to text file and edit that file by removing the 'header' and the first t=0 term, rename as something REALLY simple.

Then in octave

from there you can plot ANY number of bins in the histogram.

Sometimes it's worthwhile to explore different numbers of bins and this makes it super easy.

I sometimes 'overlay' the plots with larger and larger number of bins just looking for characteristics. Any bin that might have a 'bump' really shows up that way.

.tranoise does, but I'm usually working with white noise, sometimes 1/f but neither affect pdf ?!

I was going to mention your method, but figured you'd be right here shortly ;-) ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

That's OK, I'm building a noise generator! I want to see how Gaussian it might be, as I tweak things.

John Larkin Highland Technology, Inc picosecond timing laser drivers and controllers jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

Yup. And noise analysis has no transients! What I really want is a negative resistor with pure imaginary noise.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net

Histogramming shouldn't care about even spacing.

Sure, but that hardly provides timely feedback.

John Larkin Highland Technology, Inc picosecond timing laser drivers and controllers jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

OK. I don't know if it exists in LTspice, but I'd look for an LTspice equivalent to PSpice's "Performance Analysis". ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

The noise isn't imaginary, it's just inverted.

John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

In the Biblical sense ?>:-} ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

sqrt(-4kTR) !

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 hobbs at electrooptical dot net http://electrooptical.net

You can easily make a 2-terminal negative resistor; I made one as a college EE project. It's fun to plug -R into all the usual circuit equations.

But the noise will be real!

John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com

True, but part of making 'histogramming' not care about spacing is to evenly space the data points, else many programs 'double' count.

Using that method enabled me to make LTspice create a multitude of independent gaussian white noise sources. And I mean FLAT white noise.

Example of one: sqrt(12/5/dt)*(rand(time/dt)

+rand(tstop/dt+1+2*int(time/dt)) +rand(3*(tstop/dt+1)+3*int(time/dt)) +rand(6*(tstop/dt+1)+4*int(time/dt)) +rand(10*(tstop/dt+1)+5*int(time/dt))-2.5) }

which only requires 5 rand() functions, normalized, and fairly close approx to gaussian pdf while remaining VERY spectrally flat.

The 'list' keeps going so I have up to 50 independant gaussian white noise sources to use. Just as long as the argument of rand() does NOT exceed

2^30, the sequences do not repeat.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required