LC Filter Response

I've been trying to replicate the step response of an LC filter in LTSpice but so far I haven't been successful.

simulate this circuit – Schematic created using CircuitLab

That is the circuit I want to get the step response for. As expected, if I take the transfer function and run the step command in MATLAB, I get sustained oscillations.

$$H(s)=\frac{\frac{1}{Cs}}{\frac{1}{Cs}+ Ls}$$

Now, when I try to do it in LTSpice, I don't get that result:

I suspect the issue is that LTSpice doesn't really provide a step input as it doesn't go instantly from 0 to the final value when the source is turned on (which is what is done in MATLAB when using the step command).

• Can you put a relay in? – John Birckhead Jun 2 '16 at 21:38
• @JohnBirckhead I am not sure if I can do that, I don't know how to do that. I am starting my DC source from 0V at startup so that should replicate a step input. – Big6 Jun 2 '16 at 21:45
• Note that the resonant frequency is 6.5 MHz. You would have to greatly expand the horizontal scale of your LTspice plot to see this. – Dave Tweed Jun 2 '16 at 21:52
• I notice on your LTSPICE plot you have a very long simulation window. The period for the resonant frequency of your circuit is less than 1 us. Try changing the stop time and maximum timestep in LTSPICE. Set the maximum to be a few periods of oscillation, at minimum you need to sample at twice the Nyquest frequency which is 13.5 MHz or about 75 ns. – Captainj2001 Jun 2 '16 at 22:15
• When using this circuit in LTspice, don't forget that LTspice, by default, adds a 1mOhm series resistance to the inductance and 1/Gmin shunt resistor to the capacitance, so they can damp the oscillations (I suspect Matlab uses them ideal). If you want the oscillations to go on forever, you need to override the values, explicitly set them to zero. – a concerned citizen Jul 19 '16 at 14:27

V1 is a currently a constant DC source of 1v. To replicate the first circuit, all you need to do is "remove" V1 after some energy has been put into the L and C components.

There are many ways in which this could be done, one such way is to right-click V1, advanced, set to PWL (piece-wise linear) and specify time and voltage levels, such as 0ms 1v, 0.999ms 1v, 1.0ms 0v (which produces a sharp turn-off edge) then observe the result in the chart. As Dave says, these values of L and C will produce a relatively fast oscillation - plan on zooming in quite a bit.

If you recall from inductor theory, a charged inductor suddenly presented to an open-circuit will try to produce an infinite voltage (in order to maintain the current flowing through it.) Thus, simply removing the voltage source altogether will not work. Instead, it has to go to 0v (in other words, be a solid conductor.) Then the circuit will oscillate.

Edit: to further illustrate this phenomenon, here is a screenshot of LTspice performing the complete impulse response. Click for full-size. Note some "loss" was added to the inductor (resistance) and capacitor, to better model real-world characteristics. This is why the amplitude decays slightly over time, and was shown because real-world electronics are far from ideal, with many kinds of losses.

• I had assumed that the plot was taken from the voltage across the capacitor, not the the voltage source, but it isn't clear from the question what is actually being plotted. – Dave Tweed Jun 2 '16 at 22:04
• It's the voltage across the capacitor @DaveTweed – Big6 Jun 2 '16 at 22:08
• I've tried what you suggested @rdtsc but still can't get sustained oscillations. Anyway, when we talk about a step input (in control systems) we talk about a signal that goes from 0 to its final value instantenously and stays at its final value forever. That's what I am generating when I use the step command in matlab. – Big6 Jun 2 '16 at 22:29
• Sorry, I hadn't seen your edited answer until now. Thanks. Anyway, you don't need to actually step the voltage down to zero (after you stepped it up to some value). The LC should oscillate about the final value of your step input. If you had kept the pulse on 'forever,' the oscillation would have happened about the final value of your step input (as it was showing until you turned off the pulse). And yes, you are correct, the series resistances (losses) associated with the components will dampen the oscillations to eventually steady state. Thanks for the response. It was really helpful! – Big6 Jun 30 '16 at 16:39

Others have provided good answers, but I thought some pretty pictures would be appropriate.

Here is your circuit in LTSpice. Note that behaviour of the voltage source: instead of being a constant source, it is a step that is initially at 0 V, rising to 1 V after 100 ns, with a rise time of 1 ps (close enough to instant).

The resulting plot clearly shows the step response and desired oscillation.

• Thanks for the answer. I have tried that before and I get that. The smaller you make the rise time, the more oscillations you are going to have. Of course, we want to simulate as close as possible a step input(no rise time). But run your simulation up to, say, 8ms, and you will see that oscillations are going away and systems reaches steady state. This wouldn't be the case if the input was a pure step (rise time =0) – Big6 Jun 2 '16 at 23:22
• Well, yes. LTSpice is a timestep-based simulation environment, and events cannot happen instantaneously. As it is typically used to simulate realistic circuits, this is not an issue. What are you ultimately trying to achieve? If you want entirely ideal simulations, MATLAB or similar is going to be more appropriate. – uint128_t Jun 2 '16 at 23:25
• I just wanted to know if there was a way to accomplish this in LTSpice, but from what I see it's not possible to generate an ideal step input there. – Big6 Jun 2 '16 at 23:30
• Yeah, sorry, LTSpice isn't really appropriate for instantaneous things. Mainly because infinitely short rise times lead to infinite derivatives, which make the simulator unhappy. Stick to your transfer function solver for ideal steps. – uint128_t Jun 2 '16 at 23:32

I don't know about LTspice specifically, but many circuit simulators initialize the simulation by finding the DC operating point of the circuit. If you want to see the start-up transient behavior, you need to disable this initialization.

For example, I have tweaked the schematic in your question so that the CircuitLab simulation runs, and you have to say "Yes" to the "Skip Initial" box in order to see the transient behavior.