```Date: Nov 1, 2005 9:40 AM
Author: Jens Benecke
Subject: Optimization with external simulator (SPICE)?

Hello everybody,I have a circuit simulator (SPICE) that runs a high frequency model of anelectrical device. I want to tune the parameters of this model to fit mymeasurements. 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) ||² == minAll circuit elements are linear, within certain limits. Just R, L, C.Normally this would be simple (using \), however s(f) can only be providedwith an external circuit simulator (SPICE in this case), it is toocomplicated to be formulated mathematically. So I need to find a way to make the Matlab optimizer decide on the valuesfor the next iteration, but perform the actual calculation of s(f) by anexternal 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 reachedMy ultimate goal is to do this with m(f) and s(f) being matrices instead ofvectors, considering multiple "versions" of the circuit with different m(f)and parameter constraints for each one (e.g. one circuit with filter, onewithout filter), and running seperate external simulations for each one.Any ideas? Is this possible with the opt. toolbox? Is it feasible? CPU powerand RAM is not the problem (I can order a new 8GB Dual Opteron if that'swhat it takes). But I would like to have an idea whether Matlab is theright tool for this at all beforehand. :-)Thank you!-- Jens Benecke
```