# How would I simulate a circuit like this in LTSpice?

I want to simulate this circuit in LTSpice, but I don't know how I would enter in the values for the capacitor and the inductor. Any help would be appreciated!

• The whole point of that circuit, as given, is that you do not want to simulate it. You want to work it out by hand, so that you can understand how to do simple circuit analysis by hand. Dec 18, 2020 at 3:00
• I think you are supposed to calculate $I_g$. (I can't tell, but that's my guess.) All you need to do is to divide the voltage by the sum of the impedances. Since the impedances are in a very simple arrangement, you should be able to quickly add them up and get a result. Yes, it will have an imaginary part to it. But it's easy. Dividing by a complex number can be easily rectified by multiplying numerator and denominator by the complex conjugate of the denominator. You'll find it sorts out to a "nice" current magnitude and a "less nice" angle. But it's just right-triangle stuff.
– jonk
Dec 18, 2020 at 3:38

For the reactive components e.g. Capacitor use the equation for reactance that gives an impedance of -j5 ohms at the frequency of operation of your circuit. You can then use this to calculate the actual component values to use in your LTSpice model.

Capacitive reactance Xc = 1/(2pif*C)

Have a look at https://www.allaboutcircuits.com/tools/capacitor-impedance-calculator/ for more detail.

Such a circuit isn't typically simulated in SPICE, but it doesn't mean you can't or shouldn't. This is especially true if you need to check your work. The problem here is that you didn't specify what you want to simulate, and what you want to look at or check. So...I'll have to make assumptions going forward.

The first thing to realize is that the values given for the reactive components are their impedance (ideally they should write Z=... to prevent ambiguity). This gives you an extra degree of freedom since the components have two parameters, the frequency and the C (or L). I suggest fixing the frequency since it is a common parameter between both capacitors and inductors. Therefore, we will do a single point AC analysis at this fixed frequency. Lastly, SPICE needs the C and L values, so we can use the impedance definition for each to rewrite what you are given in terms of C and L, as such:

\begin{align} Z_{capacitor} &= \frac{1}{j \omega C} = -j5 \implies C = \frac{1}{5 \omega} \\ \\ Z_{inductor} &= j \omega L = j28.4 \implies L = \frac{28.4}{\omega} \end{align}

With this out of the way we can begin creating the LTspice schematic. For an AC analysis, the voltage source needs to be set a certain way to properly excite the circuit. We do this by right-clicking the symbol, clicking the "Advanced" button, and then entering in the amplitude and phase in the section shown below.

The next thing to do is to make parameters (using a .param SPICE directive) for $$\\omega\$$ so it's easier to deal with the simulation command later. Since SPICE usually deals in Hz, I'll make one parameter called freq which will be the main one that I'll set to 60Hz for now (doesn't really matter what it is for this circuit). We'll also use w so it's easier to enter in our C and L values. After everything is entered in, the schematic should look similar to this:

There is one caveat I'd like to address and it's the series resistance of the inductor. By default, LTspice gives all inductors a series resistance of 1mΩ. This is done to prevent circuits which cause infinite current. This doesn't apply to us since those other resistors are already in series. Therefore, we should override this to zero by right-clicking on the inductor symbol and setting the ESR to zero. This will prevent discrepancies when checking against our hand calculations.

Now, we can proceed to the simulation command. If we try to "Run" the simulation it will ask us what it wants us to do. We're going to do an "AC Analysis", and we'll set the parameters as shown below which will perform a single-point "sweep" on our defined freq. After running the simulation, we're left with a table of numbers which correspond to all the node voltages and component currents, each with their magnitude and phase values.

There is one last thing we need to be aware of. The values for current SPICE reports on each component is in the direction from node-1 to node-2 of that component. The problem is we can't see which is which, and as you rotate components around when you place them this can get rather convoluted. This results in values being either negative or 180° out of phase of what's expected. Therefore, to properly interpret the results we should do one more "trick". Let's edit the simulation command so it does a 2 point "sweep" but the 2 points are pretty much right on top of each other. It should look like this:

Now if you run the simulation the waveform viewer will pop up. As you click on nodes (for voltages) or on components (for currents), the values will show up on the waveform viewer as colored lines. But more importantly, as you hover your mouse over a component it will now show an arrow indicating which direction the current is flowing. This removes the ambiguity so now you can properly interpret the phase number plotted on the viewer by checking the arrows. To force the arrows into other directions (if desired), you will have to flip those components in your schematic and re-run the simulation. While moving components you can rotate them [ctrl+R] and/or mirror them [ctrl+E] before placing them back down. Lastly, the waveform values default to dB, so to change that to linear you simply right-click on the Y-axis dB values on the left edge and change the "Representation" to "Linear".

• This is by far the greatest answer I've ever gotten to a question like this. Thank you so much for this. Like you assumed in your answer, I was trying to find the impedance of certain components in this circuit. I forced myself like other comments in here were suggesting to learn to do the math and equations to solve for something like this, and I ended up getting a 90/100 on my circuits final yesterday, so thank you very much. I will be referring to this answer specifically in the future to better help my understanding for thing like this and I can't thank you enough!
– Muff
Dec 19, 2020 at 17:47
• Nice, dude! Congrats. Sure, no problem on the answer. If you notice, you have to already understand the underlying hand calculations to be able to even set up the simulation in the first place. Therefore, simulating isn't a replacement for the hand calculations, but rather a supplement for them. It's great for checking that you didn't goof something up! Dec 20, 2020 at 7:04
• What if you want to know the voltage drop across a component, how would you do?
– hana
Jan 10 at 12:10
• @hana In LTspice, the most easiest way to do that is to click+hold on one node and then release the click on the 2nd node. It will plot the difference between them. Jan 11 at 15:46
• @hana You cannot do that directly. That is one of reasons to use the trick at the end of the answer. You can add the step, so you can utilize all the features of the waveform UI including the ability to click+hold, then release on nodes. The .measure command might help do what you want too, but it's complicated to use. Lastly. you can also try this trick to see if it works with .ac command instead of .op: electronics.stackexchange.com/questions/534194/… Jan 12 at 6:00

First, see my comment about the advisability of doing simple circuit analysis like this in a simulator. This just isn't something to simulate -- it's something to do by hand.

Second, choose a radian frequency -- $$\\omega = 1\mathrm{\frac{radian}{second}}\$$ will be convenient. That works out to $$\f = \frac{1}{2 \pi}\mathrm{Hz}\$$. For a capacitor with impedance $$\-j X_c\$$, $$\C = \frac{1}{\omega X_c}\$$. For an inductor with impedance $$\j X_L\$$, $$\L = \frac{X_L}{\omega}\$$. Substitute in those values, simulate the circuit in AC, and get your answers.

• Note that your instructor -- if they're good -- will be expecting to see your work. Numbers that appear by magic are numbers that don't count when the point is to show you understand the technique. Dec 18, 2020 at 3:06