4.2

4.2 | 5 ratings Rate this file 34 Downloads (last 30 days) File Size: 8.24 KB File ID: #23394
image thumbnail

Fast Import of Compressed Binary .RAW Files Created with LTspice Circuit Simulator

by Paul Wagner

 

22 Mar 2009 (Updated 26 Apr 2009)

Loads .raw simulation files created with LTspice (a free circuit simulation tool).

| Watch this File

File Information
Description

LTSPICE2MATLAB imports an LTspice IV .RAW waveform file containing data from a Transient Analysis (.tran) or AC Analysis (.ac) simulation, and converts voltages and currents vs. time (or frequency) into a Matlab data structure. This function can read compressed binary, uncompressed binary, and ASCII file formats. In the case of compressed binary, the data is automatically uncompressed using fast quadratic point insertion. This function handles very large binary simulation files efficiently, and has an option to load only a subset of a file's waveforms to reduce memory consumption. Type >> help LTspice2Matlab for details.

Use LTSPICE2MATLAB to import LTspice waveforms for additional analysis in Matlab, or for comparison with measured data. LTspice2Matlab has been tested with LTspice IV version 4.01p, and Matlab versions 6.1 and 7.5., and regression testing has been used to expose the function to a wide range of LTspice settings.

Note: LTspice IV is a Spice III simulator and schematic capture tool freely avaliable for download at www.linear.com/designtools/software. It is optimized for simulation of switching regulators, but can simulate many other types of circuits as well and comes with a variety of component models.

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
23 Mar 2009 Heinrich Acker

Thanks alot for this file. It works as expected, much better than my own import function, which requires to set LTspice to ASCII output. But ASCII is not the preferred output, one usually wants to use LTspice with its .RAW format.

The source of this function uses long, descriptive varnames and has a very good help section at the beginning.

Btw, I tested with Matlab 7.5 (R2007b) and LTspice III (2.16z), and everything worked well.

It may sound pedantic, but there are only few comments after the help section and mlint gives quite some warnings on this file.

It would be nice to see this very useful program extented to other simulation types than .TRAN.

11 Apr 2009 Howard

I have tried using LTspice2Matlab.m with the 1010.asc and pll2.asc examples that come with LTspice and both produce an "unexpected Matlab operator error. This is with version 4.01p of Ltspice and versions 7.5 and 7.7 of Matlab. I also noticed Matlab's Current Directory function doesn't work with LTspice2Matlab.m

I assume others have had better results but so far I have been unable to load a raw LTspice file.

20 Apr 2009 Howard

Update, my previous comment was caused by an error I made when using LTspice2Matlab.m Once I enclosed the path and file name in single quotes the LTspice2Matlab.m file program ran successfully. I had forgotten strings have to be enclosed in single quotes in Matlab.

Howard

20 Apr 2009 Lian

this file is very useful as the analysis function in LTspice is limited in some extend.

20 Apr 2009 Lian

Hello, anybody can upload or post the commands in matlab to plot the "RAW DATA" structure into a Figure, thank you in advance.

09 Mar 2011 Mickael Lefebvre

Hi,

Thanks very much for this function, I managed to get it to work with Octave (3.2.0 on Win7). Are you interested in the modifications?
Thanks again

18 Dec 2011 sergi  
21 May 2012 Daniel

Hello,

Very useful function. However, i detect some "NaN" (not a number) conversions in MATLAB which are not a problem to plot data but it is for making calculations. Does anybody know how to deal with them without increasing the computation time.

Please login to add a comment or rating.
Updates
28 Mar 2009

Added support for AC Analysis (.ac) simulation files.

30 Mar 2009

Added support for AC Analysis (.ac) simulations

26 Apr 2009

Updated help section at beginning of file

Tag Activity for this File
Tag Applied By Date/Time
ltspice Paul Wagner 22 Mar 2009 21:30:43
spice Paul Wagner 22 Mar 2009 21:30:43
circuit simulation Paul Wagner 22 Mar 2009 21:30:43
raw Paul Wagner 22 Mar 2009 21:30:43
binary Paul Wagner 22 Mar 2009 21:30:43
data import Paul Wagner 22 Mar 2009 21:30:43
transient simulation Paul Wagner 22 Mar 2009 21:30:43
tran Paul Wagner 22 Mar 2009 21:30:43
compression Paul Wagner 22 Mar 2009 21:30:43
circuit simulation David Lloyd 28 Oct 2010 07:13:33

Contact us at files@mathworks.com