I am trying to run LTSpice transient simulations automatically using Matlab. Currently, I am using a simple RLC circuit before applying my code to my needs.
I want to 1: set the initial conditions of the LTSpice file (capacitor V and inductor I), 2: run the simulation over a period of time, and 3: set the next frame's initial conditions using the final values from the simulation.
Essentially, I want my simulation results using Matlab to be comparable to having a sinusoidal input voltage over a .tran analysis. How can I approach this? I want to set the initial conditions by using the .ic command and looping through each line of the netlist, but I am having trouble importing the data from LTSpice. How can I achieve this?
-
\$\begingroup\$ There is already a few posts like this \$\endgroup\$Voltage Spike– Voltage Spike ♦2024年10月25日 01:17:57 +00:00Commented Oct 25, 2024 at 1:17
-
\$\begingroup\$ I don’t understand what you mean by looping through the netlist and importing data to Matlab. It’s also not clear what you need to use Matlab for and in what capacity. \$\endgroup\$Ste Kulov– Ste Kulov2024年10月25日 15:13:01 +00:00Commented Oct 25, 2024 at 15:13
1 Answer 1
The short answer is you can run lt spice from the command line. To find out how it works check the help file you can run .asc or netlists. If I were you I would just modify the net list open it up as a text file in Matlab do whatever modification you need save it then run LT spice from the command line. If you need to look at an output file you can save that and then open that up and matlab as a text file.