Forums

PDF in Spice

Started by John Larkin April 28, 2015

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

On 04/28/2015 11:15 AM, John Larkin wrote:
> > > 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? > > >
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
On Tue, 28 Apr 2015 11:22:37 -0400, Phil Hobbs
<pcdhSpamMeSenseless@electrooptical.net> wrote:

>On 04/28/2015 11:15 AM, John Larkin wrote: >> >> >> 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? >> >> >> >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.
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
On Tue, 28 Apr 2015 11:22:37 -0400, Phil Hobbs
<pcdhSpamMeSenseless@electrooptical.net> wrote:

>On 04/28/2015 11:15 AM, John Larkin wrote: >> >> >> 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? >> >> >> >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
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.
On Tue, 28 Apr 2015 08:46:58 -0700, John Larkin  
<jlarkin@highlandtechnology.com> wrote:

>> ....snip.... > 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.
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
>> load filename.txt;
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.
On Tue, 28 Apr 2015 09:00:41 -0700, Jim Thompson  
<To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote:

> On Tue, 28 Apr 2015 11:22:37 -0400, Phil Hobbs > <pcdhSpamMeSenseless@electrooptical.net> wrote: > >> On 04/28/2015 11:15 AM, John Larkin wrote: >>> >>> >>> 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? >>> >>> >>> >> 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 > > Transient analysis in Spice has no noise. > > ...Jim Thompson
.tranoise does, but I'm usually working with white noise, sometimes 1/f but neither affect pdf ?!
On Tue, 28 Apr 2015 09:07:08 -0700, RobertMacy
<robert.a.macy@gmail.com> wrote:

>On Tue, 28 Apr 2015 09:00:41 -0700, Jim Thompson ><To-Email-Use-The-Envelope-Icon@on-my-web-site.com> wrote: > >> On Tue, 28 Apr 2015 11:22:37 -0400, Phil Hobbs >> <pcdhSpamMeSenseless@electrooptical.net> wrote: >> >>> On 04/28/2015 11:15 AM, John Larkin wrote: >>>> >>>> >>>> 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? >>>> >>>> >>>> >>> 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 >> >> Transient analysis in Spice has no noise. >> >> ...Jim Thompson > > >.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.
On Tue, 28 Apr 2015 09:00:41 -0700, Jim Thompson
<To-Email-Use-The-Envelope-Icon@On-My-Web-Site.com> wrote:

>On Tue, 28 Apr 2015 11:22:37 -0400, Phil Hobbs ><pcdhSpamMeSenseless@electrooptical.net> wrote: > >>On 04/28/2015 11:15 AM, John Larkin wrote: >>> >>> >>> 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? >>> >>> >>> >>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 > >Transient analysis in Spice has no noise. > > ...Jim Thompson
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
On 04/28/2015 12:00 PM, Jim Thompson wrote:
> On Tue, 28 Apr 2015 11:22:37 -0400, Phil Hobbs > <pcdhSpamMeSenseless@electrooptical.net> wrote: > >> On 04/28/2015 11:15 AM, John Larkin wrote: >>> >>> >>> 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? >>> >>> >>> >> 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 > > Transient analysis in Spice has no noise. > > ...Jim Thompson >
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
On Tue, 28 Apr 2015 09:03:40 -0700, RobertMacy
<robert.a.macy@gmail.com> wrote:

>On Tue, 28 Apr 2015 08:46:58 -0700, John Larkin ><jlarkin@highlandtechnology.com> wrote: > >>> ....snip.... >> 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. > >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.
Histogramming shouldn't care about even spacing.
> >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 >>> load filename.txt; > 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. > > >
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