How to get uniform export data from LTspice?

I;m trying to get transient data for future Matlab - calculating SNR of ADC output, but time scale of .txt exported file is not uniform- time steps seem to different from point to point. What I must to linearize or resample?

Reply to
Sergius
Loading thread data ...

this has been covered several times with the LTspicegroup. And, yes, Iforgot how to do it.

There is some form of the way to export the data file that includes the step size, or number of steps, ??

I wrote a function to linearnize the steps for LTpsice and used it until I found that out .

Did you oin the LTspice group, it's easy.

Reply to
Robert Macy

Robert, Is there a way to get uniform time-step data?

This is all I know of, from Helmut [Digest # 4440]:

[begin quote from LTspice group]

--- >

Spice variants?

Hello Jim,

Make the waveform window the active window. From the menu click File and then Export.

Best regards, Helmut

[end quote from LTspice group]

In PSpice you just insert a .print statement into your .cir file with the stepsize you want. The data appears in the .out file. ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| 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.
Reply to
Jim Thompson

n other Spice variants?

=A0 =A0 ...Jim Thompson

=A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0|

=A0 =A0 =A0 |

Jim,

I played with the form to try it out and now have NO idea where it is, or what I had done. I'll look around to see if I can find it.

Reply to
Robert Macy

other Spice variants?

Thanks!

It sure seems that Mikey would have an equivalent to every other Spice, the .print statement ??? ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| 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.
Reply to
Jim Thompson

R

me

d in other Spice variants?

=A0 =A0 =A0 ...Jim Thompson

=A0 =A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0 =A0|

=A0 =A0 =A0 =A0 |

=A0|

|

=A0 =A0 ...Jim Thompson

=A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0|

=A0 =A0 =A0 |

Here's the function I wrote to use in free Matlab clone, octave

2.1.50a which should work in later versions:

function [t,v]=3Dfillinsteps(x,y,n); % FILLINSTEPS to smooth an ordinate varying waveform % use the form [t,v,n]=3Dfillinsteps(x,y,n); % where x is the ordinate % y is the abcissa % n is the number of steps if (nargin=3D=3D0) help fillinsteps; return; endif

if (nargin ~=3D3) help fillinsteps; return; endif

[ry,cy]=3Dsize(y); t=3Dmax(x)*(1:n)/n; for i=3D1:n [xx,ix]=3Dmin(abs(x-t(i))); if (t(i)>=3Dx(ix)) if (ix=3D=3Dcy) v(i)=3Dy(cy); else v(i)=3Dy(ix)+(y(ix+1)-y(ix))*(t(i)-x(ix))/(x(ix+1)-x(ix)); endif else if (ix=3D=3D1) v(i)=3Dy(1); else v(i)=3Dy(ix-1)+(y(ix)-y(ix-1))*(t(i)-x(ix-1))/(x(ix)-x(ix-1)); endif endif endfor

Note, it IS a linear interpolation, so you will see the noise floor come up in the FFTs.

I think there is some finagling to get the x and y into this function, probably export, or print, then past onto Excel, maybe, then scoop up and put into the array, or...

Maybe it was simply strip off the header from LTspice and 'read' the text file as a variable, then strip out x and y. Yeah that sounds better.

Reply to
Robert Macy

other Spice variants?

What do you get with LTspice if you choose "ASCII data files" (CSDF)? ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| 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.
Reply to
Jim Thompson

SNR

time

or

s,

s

ound in other Spice variants?

th

=A0 =A0 =A0 ...Jim Thompson

=A0 =A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 =A0 | =A0 =A0 et =A0 =A0 =A0|

=A0 =A0|

=A0 =A0 =A0 =A0 =A0 |

=A0|

=A0 |

od.

,

=A0 =A0 =A0 ...Jim Thompson

=A0 =A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0 =A0|

=A0 =A0 =A0 =A0 |

=A0|

|

);

=A0 =A0 ...Jim Thompson

=A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0|

=A0 =A0 =A0 |

I don't know.

But someone finally posted the complete method:

Use LTspice2Matlab.m function to read and convert the .raw file to uniform steps.

Before I knew that existed, I would go to FILE, select Export, and the file automatically comes out as a two column non-uniform text list of calculations. I would remove the Header with a text editor, and simply 'read' the file into octave, then I used my custom fillinsteps.m [not knowing someone had already written interp1.m and was a built-in function] then I would save the data in ascii and get a text list of uniform steps.

A bit of a workaround, but when you don't do this often, workarounds take less time. Probably would go through all these steps if I did it again, because I tend to reinvent the wheel each time and that's the logical sequence

Reply to
Robert Macy

in other Spice variants?

It occurs to me that one could simply import the text list into PSpice as a PWL, run it as a source, but call a .PRINT statement with the timestep I choose to convert it to evenly spaced.

Is LTspice2Matlab.m a Matlab routine, or where do you run it? ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| 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.
Reply to
Jim Thompson

ing SNR

rm- time

ze or

yes,

udes

it

e found in other Spice variants?

t?

with

is,

,

=A0 =A0 ...Jim Thompson

=A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0|

=A0 =A0 =A0 |

If you have Matlab, run as a normal function putting in all the arguments and requesting all your outputs.

In octave, you can place it in a script file to run, or run from the console line entry.

I only used it to verify and found it did work. But, every time I 'uniformed' the steps, I always reverted to my old technique since I could count on it.

Do you have Matlab, or free octave?

Did you try the waveform source and PRINT function to see if that worked?

Reply to
Robert Macy

SNR

time

found in other Spice variants?

Neither. But with the requests for Spice to IBIS coming in I do need a convenient numeric processor. ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| 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.
Reply to
Jim Thompson

lating SNR

iform- time

arize or

nd, yes,

ncludes

sed it

are found in other Spice variants?

list?

ile with

|
.

it is,

r

ion,

up

he

)?

e

it

=A0 =A0 =A0 ...Jim Thompson

=A0 =A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0 =A0|

=A0 =A0 =A0 =A0 |

=A0|

|

=A0 =A0 ...Jim Thompson

=A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0|

=A0 =A0 =A0 |

Stay away from trying to use Excel ;)

I recommend octave 2.1.50a for its plotting! However, if you're doing high power arrays, latest version is better, accepts 3 indices.

More advantageous, the users group will usually post help response within a few hours 24/7. If you're like me, you work anytime and don't want to interface with 'customer service' only during business hours.

I use octave to test DSP algorithms BEFORE writing the C, C++ code.

First time Directions: Get a good text editor, like SC1 from Scilab. Set it up to open .m files. Install octave. place all your working .txt files and .m files in the octave_files folder. Run octave. Either command line prompt, step by step, or write a TestScript.m file using the editor At the prompt type in the name of the script file, in this case TestScript [don't add the .m It's implied] and octave will run your script. You can open files, read files either text or binary, save files either text or binary. etc.

Fastest way to learn is try to do the first thing you want done? LTspice analyze the problem and export results in text format. Keep simple. only one variable. Edit the file to remove header, only have numbers, save as out.txt.

At the command prompt type

then type

that will put the thing into 'normal' forms

you now have time as t in nonuniform steps and you have v at each time point.

How many points do you want? 1000? type in

[or use the built in function interp1.m] and voila! even number of steps

save as a text file by typing

and then look at that file. You'll find that the arrays are across and not down if you want down like the original format change the variables:

or if you want the 'down' array to be in the similar format as the original:

then you can use your text editor to change the header to the original header and you're done.

Reply to
Robert Macy

calculating SNR

uniform- time

linearize or

yes,

includes

it

found in other Spice variants?

with

is,

Thanks, Robert, I'll give it a whirl. ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| 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.
Reply to
Jim Thompson
[snip]

Robert, For those of us using only Windows... which installer should I download? ...Jim Thompson

-- | James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.

Reply to
Jim Thompson

=A0 =A0 ...Jim Thompson

=A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0|

=A0 =A0 =A0 |

windows binary?

I opt for going to that website which carries old programs and getting octave 2.1.50a At least, you'll be COMPLETELY compatible with my comments, and this is incredible, but when they changed to the 3 version, they broke all my plot functions and what they replaced it with is SLOW!!! All to completely maintain that octave is an EXACT Matlab clone. The group still has flurries of questions on how to speed up plotting.

You can't believe the difference in the plot routines/commands/speed. For example, I can plot a 3D mesh plot that is 250 by 250 data points instantly and rotate it around with mouse control to view anything I want. The NEW plot program starts bogging down at only 25 by 25 with the same speed of screen updates!!! And believe me, there is more information in a rotated plot than you can believe.

I wrote so many custom plot routines I could NOT abandon them, for example I can plot a complex function as a line, which you can view down its end and see real-imaginary or rotate slightly and see along the time line to see either real, or imaginary. Plus, with the rotation capability I can view everything, real and imaginary along the whole time line. Very handy for phase shifting those FFTs to find the EXACT delay even when the delay is between sample points. Like time line resolution is in steps of 50 uS, but you can easily resolve the delay down below 1 uS

The versioon I stopped upgrading at is small, at around 7.577MB: octave-2.1.50a-inst.exe self installs, just keep hitting default answers [enter] to every question, until it's done

talk about bloating code, when they went to ver 2.9 that is 35MB !!! I have no idea what it's at now. Probably set up to run on WinXP or such.

The good part is that whatever you learn using octave 2.1.50a will be applicable to any updated version, ...except the plot routines.

Reply to
Robert Macy

Got a link that takes me to that 2.1.50a installer? ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| 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.
Reply to
Jim Thompson

=A0 =A0 =A0 ...Jim Thompson

=A0 =A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0 =A0|

=A0 =A0 =A0 =A0 |

=A0|

|

=A0 =A0 ...Jim Thompson

=A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0|

=A0 =A0 =A0 |

formatting link

odd place?

Reply to
Robert Macy

Thanks! ...Jim Thompson

--
| James E.Thompson, CTO                            |    mens     |
| Analog Innovations, Inc.                         |     et      |
| Analog/Mixed-Signal ASIC's and Discrete Systems  |    manus    |
| Phoenix, Arizona  85048    Skype: Contacts Only  |             |
| 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.
Reply to
Jim Thompson

d I

=A0 =A0 =A0 ...Jim Thompson

=A0 =A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 =A0 | =A0 =A0 et =A0 =A0 =A0|

=A0 =A0|

=A0 =A0 =A0 =A0 =A0 |

=A0|

=A0 |

od.

g

th

ind

r

=A0 =A0 =A0 ...Jim Thompson

=A0 =A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0 =A0|

=A0 =A0 =A0 =A0 |

=A0|

|

=A0 =A0 ...Jim Thompson

=A0 =A0| =A0 =A0mens =A0 =A0 |

=A0 | =A0 =A0 et =A0 =A0 =A0|

=A0|

=A0 =A0 =A0 |

While you're there, you should download a copy of femm 4.2 femm42bin.exe only 1.7MB and self installs

Totally awesome finite element analyses for magnetics, electrostatics, and heat flow.

Reply to
Robert Macy

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.