The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Optimization with external simulator (SPICE)?
Replies: 5   Last Post: Jul 14, 2013 3:52 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Marcelo Marazzi

Posts: 24
Registered: 8/29/05
Re: Optimization with external simulator (SPICE)?
Posted: Nov 1, 2005 12:43 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

If you can invoke the simulator as a callable library,
then you can try to call it from within your MATLAB
objective function.

See the MATLAB External Interfaces section in the doc:


Jens Benecke wrote:
> Hello everybody,
> I have a circuit simulator (SPICE) that runs a high frequency model of an
> electrical device. I want to tune the parameters of this model to fit my
> measurements. I am considering using the Optimization toolbox for this.
> Basically I have two sets of frequency dependant variables m(f) and s(f),
> and I need to tune about 20 variables (values of resistors, capacitors,
> etc) within quite restrictive constraints (factor 10 at most) so that
> || m(f) - s(f) ||² == min
> All circuit elements are linear, within certain limits. Just R, L, C.
> Normally this would be simple (using \), however s(f) can only be provided
> with an external circuit simulator (SPICE in this case), it is too
> complicated to be formulated mathematically.
> So I need to find a way to make the Matlab optimizer decide on the values
> for the next iteration, but perform the actual calculation of s(f) by an
> external program (and then read the external program's output file).
> The idea is:
> Matlab decides on initial values for all variables
> Matlab writes SPICE netlist with those values
> Matlab calls SPICE simulator
> Matlab reads results
> ... loop until max iterations or required min. difference reached
> My ultimate goal is to do this with m(f) and s(f) being matrices instead of
> vectors, considering multiple "versions" of the circuit with different m(f)
> and parameter constraints for each one (e.g. one circuit with filter, one
> without filter), and running seperate external simulations for each one.
> Any ideas? Is this possible with the opt. toolbox? Is it feasible? CPU power
> and RAM is not the problem (I can order a new 8GB Dual Opteron if that's
> what it takes). But I would like to have an idea whether Matlab is the
> right tool for this at all beforehand. :-)
> Thank you!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.