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. :-)