I am new in LTspice and optimization. Could someone please get me started on how to use LTspice and MATLAB together to run a gradient descent optimization and update the value of parameters? I am trying to simulate a Nonlinear Transmission Line and optimize the output. Any help would be appreciated.
-
\$\begingroup\$ look into this newsgroup and ask your question there. groups.io/g/LTspice \$\endgroup\$user69795– user697952024年09月26日 19:52:45 +00:00Commented Sep 26, 2024 at 19:52
1 Answer 1
I can help with the update parameters part and running LT spice from matlab. In short, you will need to run a netlist file with spice. Make a spice netlist file of your circuit. Open the spice netlist file in matlab and then run it from the command line.
As far as gradient decent, that will need to be your own algorithm. If your measuring a voltage or something you can spit out the .meas commands in a text file and then read them as a txt file in matlab. You would then need to optimize those values by changing the circuit parameters.
This is how you run LT spice from the command line.
With spice, you'll have to roll your own code but there are ways to get data in and out of LT Spice and run it from a scripting language.
If you run LT spice in command line mode, from a windows command line:
Run in batch mode. E.g. "scad3.exe –b deck.cir" will leave the data in file deck.raw "scad3.exe –b deck.cir"
Or you'd probably want a .txt file which you could then import back into a scripting language
'ltsputil.exe -ca example.raw dete.txt'