[dorkbotdc-blabber] MATLAB Circuit Simulation and Analysis

Tim Slagle tim at slagle.org
Wed Apr 1 16:01:18 EDT 2009


MATLAB is great for image processing or matrix math because it has the built-in syntax and libraries to make the source code very compact - just like writing the equations down.  It is interpreted so you pay a price in execution speed for simple loops that don't use the vector libraries.  Recent MATLAB versions have added a just-in-time compiler to make loops and such run faster, and that has boosted the speed a lot for people who write code C or FORTRAN style instead of using the vectorization.  But considering the cost of the package, unless you will take advantage of the libraries you'd probably better off using C/C++ if you are already comfortable with them.

MATLAB also has support for sparse matrices, although I haven't used that feature.  If you look at a circuit as a vector of nodes and the interconnections between nodes as a matrix, most of the matrix elements would be zero (no connection).  So sparse matrices can save memory in big circuits, and I think SPICE uses sparse matrix solvers internally.  But as far as I know there are no built-in or add-on packages for circuit simulation in MATLAB, at least through the MathWorks.  

There is also a sister package Simulink that is typically used for control theory and system simulation, and it is better for time-sequential computations.  You can model your system by drawing block diagrams and then write code for each block's functions.  And, there is a SimElectronics add-on for it.  But Simulink is even more expensive than MATLAB.  (They are independent products although I'm sure you can go back and forth).
--Tim



----- Original Message ----
> From: Mike O'Dell <mo at ccr.org>
> To: dorkbotdc-blabber at dorkbot.org
> Cc: HacDC Public Discussion <blabber at hacdc.org>
> Sent: Wednesday, April 1, 2009 2:38:34 PM
> Subject: Re: [dorkbotdc-blabber] MATLAB Circuit Simulation and Analysis 
> 
> that sure sounds more like SPICE than Matlab
> 
> based on my (admittedly thin) experience, Matlab excels at
> jobs where closed-form analytic solutions exist, ideally in
> matrix form. Signal processing and control theory come to
> mind as natural fits. While one can formulate DC circuits
> in such forms, it's a lot more natural to do it in SPICE
> since the input form is a transliteration of the schematic.
> 
> i'd be interested to find out that similar facilities exist
> for Matlab, but in my experience, Matlab is for system
> dynamics (control loops) and SPICE is for circuit dynamics.
> 
>      -mo
> ........................................................................
> .......dorkbot dc: people doing strange things with electricity.........
> ................... http://dorkbot.org/dorkbotdc .......................
> ...................   SUBSCRIPTION MANAGEMENT    .......................
> ........ http://dorkbot.org/mailman/listinfo/dorkbotdc-blabber ........
> ........................................................................



More information about the dorkbotdc-blabber mailing list