1
\$\begingroup\$

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.

toolic
10.8k11 gold badges31 silver badges35 bronze badges
asked Sep 26, 2024 at 18:59
\$\endgroup\$
1
  • \$\begingroup\$ look into this newsgroup and ask your question there. groups.io/g/LTspice \$\endgroup\$ Commented Sep 26, 2024 at 19:52

1 Answer 1

1
\$\begingroup\$

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'

start a LTSpice simulation using code in MacOS

answered Sep 27, 2024 at 20:18
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.